Autogenerate cron task with new server
I try to create new server and add in User Data command to create new cron task.
sudo apt-get install cron (crontab -l ; echo "* * * * * php /var/www/html/test.php") | crontab -
When I run ‘nano /var/spool/cron/crontabs/root’, I get :
# DO NOT EDIT THIS FILE - edit the master and reinstall. # (- installed on Wed May 24 08:27:25 2017) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) * * * * * php /var/www/html/test.php
Unfortunelly server doesn’t run my test file.
PHP syntax in file is correct, because when I run it via browser everything work propelly.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×