Ubuntu 18.04: The docker calling cron tasks silently fails in the running parts, but works in the simple crontab

I've copied several cron tasks from a CentOS 7 server, where they were running cron.daily, on a new Ubuntu 18.04 server. Tasks call fixed menu containers and look like this:

#! / bin / bash
/ usr / bin / docker exec container name script.sh name

Scripts are executable and work properly when called by the root of a shell:

/etc/cron.daily/script.sh # it works

In addition, when I call the scripts directly from / etc / crontab they work:

35 0 * * * root /etc/cron.daily/script.sh # it works

However, they should be invoked by run-parts:

45 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * Root test -x / usr / sbin / anacron || (cd / && run-parts --report /etc/cron.daily)

This fails silently both when the script is in cron.hourly and cron.daily. The syslog contains lines like:

July 17 09:45:01 CRON servername[5436]: (root) CMD (cd / && run-parts -v /etc/cron.hourly)

In other words, run-parts call. Other scripts in cron.hourly and cron.daily who do not call docker seem to work. There is no error message that I can find. On CentOS, I would have assumed that it was a problem related to SELinux, but I'm puzzled. The scripts are executable (otherwise they could not have been called since crontab), the docker client is not interactive and does not use the terminal (no -he).

What could be the problem?

Note that I have a perfect workaround here. I can just call crontab jobs, the problem is solved. I post because I want to understand why this does not work when the scripts are invoked by runtime parts so that I can avoid committing a similar error in the future.

c ++ – Calling a recursive function with the decrement operator

I wrote a code to solve a problem of factorial sum. When I created the recursive function for the factorial calculation, I used the decrement operator "-" followed by the number in the function call, which generated an error in the answer. Can any one explain the reason for using the operator to modify the answer? Follow the code below.

using namespace std;

long long factorial inte (long long int num) {
if (num == 1 || num == 0) returns 1;
return num * factorial (- num);

int main () {
long long int M, N;
while (scanf ("% lli% lli", & M, & N)! = EOF)
factorial (M) + factorial (N) << endl;
returns 0;

Magento 2 Calling widget / template_filter in .phtml format

Where is the equivalent way of writing the following Magento 1 code to call a custom widget in Magento 2.3.1?

Mage :: getSingleton ('widget / template_filter') -> filter ($ _ product-> getData (& # 39; variants & # 39;))

plugins – Calling a single API exposed via a shortcode with params

I'm trying to create a plugin with a single shortcode that asks a parameter to identify the field to extract from the response of my JSON API.

The API returns several values ‚Äč‚Äčthat I try to identify. For example:

[user_link type="url"]

would only expose the URL, while

[user_link type="user_name"]

just expose the name.

All of this should only hit the API once, not twice.

I've tried to configure my plugin file so that it looks like this:

$ api_response = null;

get_user_info function ($ type) {
if ($ api_response === null) {
... do api reqest
$ api_response = data of the api request;
returns $ api_response[$type];
} other {
returns $ api_response[$type];
add_shortcode ("user_link", "get_user_info");

This always results in several API requests, one by shortcode that I add. I believe this happens for one of two reasons. Either the $ api_response variable is cleared, or the short codes all run at the same time, and the variable is not set when the next one is executed.

Is my approach here completely extinguished? Is there a way to accomplish that? I try to expose each piece of data separately to allow the end user to view and stylize the data as he wishes.

Calling a WCF service with jquery ajax from Sharepoint Online

I've used these codes to call an application installed on the client and configured to listen to a port on the local host, from a page containing a form published in Sharepoint Online.
In this case, I had to assign "http: // localhost: xxxx" to call_UrlEndpoint, but instead try to put your intranet URL.

openLocalApp function (call_UrlEndpoint, dataJson) {
$ .ajax ({
url: call_UrlEndpoint,
type: "POST",
async: true,
data: JSON.stringify (dataJson),
jsonp: "reminder",
jsonpCallback: "save",
contentType: 'application / json',
processData: false,
crossDomain: true,
dataType: & quot; jsonp & # 39;
success: function (answer) {
alert ("success");
error: function (answer) {
alert ("The scan component failed!");


mysqli – mysqli_connect () mysqli_connect (): (HY000 / 2002): No file or directory error of this type when calling from another php file

I am a little weird here and I am unable to find the cause on the web search.

I have a functions.php file that contains the following code:

function random_color_part () {
returns str_pad (dechex (mt_rand (0, 255)), 2, & # 39; 0 & # 39; STR_PAD_LEFT);

random_html_color () {function
returns random_color_part (). random_color_part (). color_ random_part ();

function unique_random_colors ($ sql) {
$ link2 = mysqli_connect ($ DB_HOST, $ DB_USER, $ DB_PASS) or die (mysqli_connect_error ());
mysqli_select_db ($ link2, $ RMV_DB) or die (mysqli_error ($ link2));

$ m = array ();
if ($ query = mysqli_prepare ($ link2, $ sql)) {

mysqli_stmt_execute ($ query);
mysqli_stmt_bind_result ($ query, $ user_id);

while (mysqli_stmt_fetch ($ query)) {
$ m[$user_id] = random_html_color ();
} other {
returns FALSE;
mysqli_close ($ link2);
returns $ m;

In another file, let's call it main.php:

<? php
require_once (& # 39; functions.php & # 39;);
$ link = mysqli_connect ($ DB_HOST, $ DB_USER, $ DB_PASS) or die (mysqli_connect_error ());
$ my_stmt = SELECT DISTINCT user FROM articles_discussion WHERE article = & # 39; mysqli_real_escape_string ($ link, $ _GET['aid'])
print_r (unique_random_colors ($ my_stmt);
mysqli_close ($ link);

but I get the error mysqli_connect () mysqli_connect (): (HY000 / 2002): No such file or directory and he says that this is happening on the line depending unique_random_colors who reads $ link2 = mysqli_connect ($ DB_HOST, $ DB_USER, $ DB_PASS) or die (mysqli_connect_error ());

Why would this tell me that a file or directory does not exist? If I copy and paste the function code into a standalone file and run it with some modifications only to make it syntactically correct, it works fine. As soon as I try to call him from functions.php this gives the error.

C # – Doubt for not calling the function

good night, I use acbrframework to read the weight of the scale and FAST REPORT to print a command I use a button to call the function until ok ok but I would call the function alone without the customer needing to press the button read and print the command

woocommerce – Message Uncaught Error: Calling a member function is_taxonomy ()

I receive the following error message

Line 78
Uncaught message error: Calling a member of the is_taxonomy () function on a string in / home / kevinh96 / public_html / wp-content / plugins / jc-woocommerce-advanced-attributes / libs / class-jcaa-product-template .php: 78 Stack trace: # 0 /home/kevinh96/public_html/wp-content/plugins/jc-woocommerce-advanced-attributes/libs/class-jcaa-product-template.php(274): JCAA_Product_Toduct_template-> jcaa_populate_attr ( ). /home/kevinh96/public_html/wp-content/plugins/jc-woocommerce-advanced-attributes/libs/class-jcaa-product-template.php(357): JCAA_Product_Template-> output_product_tildute (). /public_html/wp-includes/class-wp-hook.php(286): JCAA_Product_Template-> output_archive_attributes (& # 39;) # 3 / home / kevinh96 / public_html / wp-includes / class-wp-hook .phhr310) WP_Hook-> apply_filters (NULL, Array) # 4 /home/kevinh96/public_html/wp-includes/plugin.php(465): WP_Hook-> do_action (Array) # 5 / home / kevinh96 / public_html / wp- content / plugins /woocommerce/templates/content-product.php(65): do_action (& # 39; woocommerce_aft ..) # 6 / home / kevinh96 / public_ht
File /home/kevinh96/public_html/wp-content/plugins/jc-woocommerce-advanced-attributes/libs/class-jcaa-product-template.php

An idea how to solve this problem?

Thank you

interface – Problem when calling an interface in kotlin

I did a project in my work and I was asked to pass it to Kotlin. After spending the whole project, there is a part that gives me a code error all the time (not during its execution) and that tells me that the interface has no parameter. Clearly, this is my first time in Kotlin and I have no idea, but I have an idea. I tried to solve it and I did not have it. So I was asking for help, I get an error at the very beginning of the

= SpeechService.Lintener {

            // METHOD
private value mSpeechServiceListener = SpeechService.Listener {text: String ?, isFinal: Boolean ->
if (estFinal) {
mVoiceRecorder !!. fire ()

if (mText! = null &&! TextUtils.isEmpty (text)) {
runOnUiThread {
if (estFinal) {

if (mText !!. text.toString (). equals ("hello", ignoreCase = true) || b == true) {
if (b == true) {
mText !!. text = null
mTextMod !!. text = text

repro (). onPostExecute (text)
random = 2
} else {
b = true
mText !!. text = null
val saludo = "Welcome, what do you want?"
mTextMod !!. text = greeting
repro (). onPostExecute (welcome message)

} else {
mText !!. text = text

And here I put the caller (who is in a different class)

Listener interface {

fun onSpeechRecognized (text: String ?, isFinal: Boolean)


If you could help me, I would thank you enough