Support is online

Cron job doesn't run #7936

Open cybernaute opened this topic Wednesday, 06 January 2016 · 4 replies
Author

**
Maybe you can help me with this, when we execute the commands by hand everything is ok:**

$SERVER =
array(39) {
["HOSTNAME"]=>
string(27) "serverhostname"
["SHELL"]=>
string(9) "/bin/bash"
["TERM"]=>
string(5) "xterm"
["HISTSIZE"]=>
string(4) "1000"
["SSH_CLIENT"]=>
string(22) "…"
["QTDIR"]=>
string(17) "/usr/lib64/qt-3.3"
["QTINC"]=>
string(25) "/usr/lib64/qt-3.3/include"
["SSH_TTY"]=>
string(10) "/dev/pts/0"
["USER"]=>
string(4) "root"
["LS_COLORS"]=>
string(1253) "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.rar=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:.xspf=00;36:"
["PATH"]=>
string(141) "/usr/local/jdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin"
["MAIL"]=>
string(20) "/var/spool/mail/root"
["PWD"]=>
string(26) "/home/hostname/importation"
["JAVA_HOME"]=>
string(14) "/usr/local/jdk"
["EDITOR"]=>
string(4) "pico"
["LANG"]=>
string(11) "en_US.UTF-8"
["HISTCONTROL"]=>
string(10) "ignoredups"
["HOME"]=>
string(5) "/root"
["SHLVL"]=>
string(1) "2"
["LS_OPTIONS"]=>
string(25) "--color=tty -F -a -b -T 0"
["LOGNAME"]=>
string(4) "root"
["CVS_RSH"]=>
string(3) "ssh"
["QTLIB"]=>
string(21) "/usr/lib64/qt-3.3/lib"
["VISUAL"]=>
string(4) "pico"
["SSH_CONNECTION"]=>
string(38) "…"
["CLASSPATH"]=>
string(32) ".:/usr/local/jdk/lib/classes.zip"
["LESSOPEN"]=>
string(25) "||/usr/bin/lesspipe.sh %s"
["HISTTIMEFORMAT"]=>
string(6) "%F %T "
["G_BROKEN_FILENAMES"]=>
string(1) "1"
["
"]=>
string(18) "/usr/local/bin/php"
["PHP_SELF"]=>
string(76) "/home/hostname/public_html/administrator/components/com_csvi/helper/cron.php"
["SCRIPT_NAME"]=>
string(76) "/home/hostname/public_html/administrator/components/com_csvi/helper/cron.php"
["SCRIPT_FILENAME"]=>
string(76) "/home/hostname/public_html/administrator/components/com_csvi/helper/cron.php"
["PATH_TRANSLATED"]=>
string(76) "/home/hostname/public_html/administrator/components/com_csvi/helper/cron.php"
["DOCUMENT_ROOT"]=>
string(0) ""
["REQUEST_TIME_FLOAT"]=>
float(1452084877.58)
["REQUEST_TIME"]=>
int(1452084877)
["argv"]=>
array(3) {
[0]=>
string(76) "/home/hostname/public_html/administrator/components/com_csvi/helper/cron.php"
[1]=>
string(14) "--key=imp_prod"
[2]=>
string(15) "--template_id=6"
}
["argc"]=>
int(3)
}

**
But when we use Crontab Linux to execute the commands it seems the server variables are differents and causes errors: **

$SERVER =
array(15) {
["SHELL"]=>
string(7) "/bin/sh"
["MAILTO"]=>
string(25) "name@mydomain.com"
["USER"]=>
string(8) "myuser"
["PATH"]=>
string(13) "/usr/bin:/bin"
["PWD"]=>
string(14) "/home/hostname"
["LANG"]=>
string(11) "en_US.UTF-8"
["SHLVL"]=>
string(1) "1"
["HOME"]=>
string(14) "/home/hostname"
["LOGNAME"]=>
string(8) " myuser"
["
"]=>
string(12) "/usr/bin/php"
["PHP_SELF"]=>
string(0) ""
["REQUEST_TIME_FLOAT"]=>
float(1451933701.83)
["REQUEST_TIME"]=>
int(1451933701)
["argv"]=>
array(4) {
[0]=>
string(76) "/home/hostname/public_html/administrator/components/com_csvi/helper/cron.php"
[1]=>
string(18) "--task=maintenance"
[2]=>
string(18) "--addon=virtuemart"
[3]=>
string(20) "--operation=backupvm"
}
["argc"]=>
int(4)
}
**Here are the errors, nothing is executed : **
Notice: Undefined index: SCRIPT_NAME in /home/hostname/public_html/libraries/joomla/application/web.php on line 869
Notice: Undefined index: SCRIPT_NAME in /home/hostname/public_html/libraries/joomla/application/web.php on line 1139
Notice: Undefined index: SCRIPT_NAME in /home/hostname/public_html/libraries/joomla/uri/uri.php on line 96
Notice: Undefined index: SCRIPT_NAME in /home/hostname/public_html/libraries/joomla/uri/uri.php on line 167

Support

Hello,

I moved this topic to a thread of it's own.

But when we use Crontab Linux to execute the commands it seems the server variables are differents

Notice that you are using different PHP instances:
By hand: "/usr/local/bin/php"
By cron: "/usr/bin/php"

It is pretty safe to say that these are also different PHP versions. So make sure you are comparing the correct versions.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

I thought that I hadn't post the message, I didn't saw that you started a new thread.

Support

Why are you posting the same message?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Sorry about the duplicate message from before.

You were right about the PHP instances. It worked like a charm!

Thanks a lot!!

Log in to reply to this topic.