1

I've tried a range of combinations for adding a cron job. I can't tell if there is a problem with my cron command, or if it's something about the users on the server. Currently I've added this cron to run under sudo. I'm confident the path to php and path to my cron are correct, and when I visit that cron.php file it stores the time() in a log so I know that part works... also permissions are 755 on the cron.php file.

*/1 * * * * /opt/bitnami/php/bin/php /opt/bitnami/apache2/htdocs/cron.php cron:run

I've tried adding this cron using sudo crontab -e, sudo crontab -u root -e, crontab -e. I've also tried combinations where the user is state in the cron command like:

*/1 * * * * sudo /opt/bitnami/php/bin/php /opt/bitnami/apache2/htdocs/cron.php */1 * * * * root /opt/bitnami/php/bin/php /opt/bitnami/apache2/htdocs/cron.php */1 * * * * bitnami /opt/bitnami/php/bin/php /opt/bitnami/apache2/htdocs/cron.php

So far no combination works, and there are no errors in the server log.

I've tried restarting cron with sudo /etc/init.d/cron stop, sudo /etc/init.d/cron start. The start/stop works so I'm sure cron is running... but I'm not sure if cron runs as "root", "sudo" or "bitnami"?

goldhat
  • 41
  • 6
  • check this link https://stackoverflow.com/questions/46863562/is-it-possible-to-have-cron-job-running-on-amazon-lightsail-instance – Padmanathan J Jan 21 '20 at 18:56
  • I saw that link it's one of the few resources specific to lightsail and cron, but his steps did not work for me and he didn't seem to run into any issues with the user permissions... also different file structure on his server. – goldhat Jan 21 '20 at 20:02
  • 1
    Bitnami Engineer here, can you verify the command works properly when you run the command manually? If the command works properly, you can modify the cronjob to redirect the output of the command to a file in the system (`> /tmp/output_of_the_command.txt`) so you can verify it's also running properly in the automated task. You can also try using a dummy command (for example `* * * * * date > /tmp/date.txt`) to confirm that cron is running properly. – Jota Martos Jan 23 '20 at 09:19

0 Answers0