in my crontab there is a script starting at 2:40 AM, executing some routines both from sh commands and php scripts starting from sh files.
the line in crontab looks like this:
SHELL=/BIN/BASH PATH=/sbin:/bin:/usr/sbin:/usr/bin:/mypath 40 2 * * * root run-parts /etc/cron.twoam
inside the folder cron.twoam there is one script, let's call it script1: inside script 1 some other scripts get called, and they are executed fine. Then it comes time of this script let's call it script2, called from script1. i leave traces both on txt files and system logs to check what happens.
echo "exec script2" >> /mypath/txtlog /mypath/script2 > /mypath/txtlog2 echo "end of script2" >> /mypath/txtlog logger -p local1.info "09@ script2 executed" echo "end of crontwoam" >> /mypath/txtlog date >> /mypath/txtlog
.... other script that runs fine
now let's see what is inside script2:
some scripts.... /mypath/subpath/script3 other scripts...
now let's check script3:
various php commands cd /phppath/ php /phppath/myscript.php >> /mypath/myphplog php /phppath/otherscript.php >> /mypath/myphplog
and finally comes the php script. the php script has various included script. every one of them execute normally except one. whenever i put it from line 2 to line 90 the execution will silently stop there.
so it comes the part where i do
and things after does not get executed.
phpscripts2.php runs fine if executed by command line
php phpscripts2.php by my user or by root.
inside phpscripts2 there is ( i include meaningfull parts):
echo "started phpscripts2" exec("mysqldump ......"); ftp_connect(); file_get_contents("https://someotherscriptsondifferentserver"); echo "ended phpscripts2"
now what i find in logs: in /mypath/txtlog i found both
end of script 2
in myphplog i found
and row after
i' m missing end of phpscript2 that end prematurly. run time of phpscript2 is about 2 minutes.
i can't find traces in any log of some error. where could i look?
i forgot to add that if make a sh file that calls just this script, and i make a custom crontab line to call it just for test, everything runs.