Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cronjob doesn't run on Google Compute Engine

I set up a cron job in a instance on Google Cloud's compute engine.

It is suppose to run at 7:47am every day. However each time I check if the file has been executed at 7:48 it does not work.

enter image description here

The code for the helloworld.sh file is here

echo "helloworld" + "$(date)" > helloworld.txt

I have set checked as root and set up the cron job as root still nothing. Any ideas?

like image 976
Quinnystar27 Avatar asked Nov 19 '22 01:11

Quinnystar27


1 Answers

The cron job is wrong because you need to use absolute paths in your command. Try:

/bin/bash /home/username/helloworld.sh
like image 195
Alex Palcuie Avatar answered Dec 11 '22 15:12

Alex Palcuie