Hey guys, I'm using ISPConfig 3.1 in a Multiserver Setup. On one server the cron.sh is not really working, I think. Logs aren't rotate, Trafficusage not in the Database, ... . I created a small script (999-test.php) and put it in '/usr/local/ispconfig/server/lib/classes/cron.d/'. The script should only write a file into a web-log folder but nothin happens. In cron.log it will be shown. Code: Included cronjob_test from /usr/local/ispconfig/server/lib/classes/cron.d/999-test.php -> will now run job. Called run() for class cronjob_test Job has schedule: * * * * * Called onPrepare() for class cronjob_test Called onBeforeRun() for class cronjob_test Jobs next run is 1484386349 Date compare of 1484386349 and 1484386349 is 0 Jobs next run is now 2017-01-14 09:33:0 Called onRun() for class cronjob_test Called onAfterRun() for class cronjob_test Called onCompleted() for class cronjob_test run job (cronjob_test) done. Code: <?php class cronjob_test extends cronjob { // job schedule protected $_schedule = '* * * * *'; /* this function is optional if it contains no custom code */ public function onPrepare() { global $app; parent::onPrepare(); } /* this function is optional if it contains no custom code */ public function onBeforeRun() { global $app; return parent::onBeforeRun(); } public function onRunJob() { global $app, $conf; touch('/var/log/ispconfig/httpd/marcohanisch.de/test.log'); parent::onRunJob(); } /* this function is optional if it contains no custom code */ public function onAfterRun() { global $app; parent::onAfterRun(); } } ?> Whats going wrong on my machine? Thanks Marco
can you run php -r "touch ('/var/log/ispconfig/httpd/marcohanisch.de/test.log');" witout any errors? you can also trigger an action if touch() fails. if(!touch('log')) do_something
And you did not see the log with the current timestamp? You can debug your class using php /usr/local/ispconfig/server/cron_debug.php --cronjob=999-test.inc.php
Hey Florian, thank you for your answer. I found the problem... For a reason not known to me the table "sys_cron" was not available. After I have created the table directly on the MySQL Server, every Job is working fine... Hmm.. I found in some jobs '$_run_at_new == true' at the top. Have taken it to my test job, after that it worked without any problems. I have read something through the documentation and encountered the usage of this table... https://fossies.org/dox/ISPConfig-3.1.1p1/cronjob_8inc_8php_source.html Sometimes it is easier than you think. Marco