Home > Enterprise >  Cronjob won't trigger .sh script
Cronjob won't trigger .sh script

Time:04-12

I have made this Cronjob that should run some tests. My script works, but cronjob won't trigger it.

Cronjob looks like this:

*/1 * * * * /bin/sh cd ~/Desktop/abc.sh

I want it to run every minute, just for testing purposes.

And my script is:

while read LINE; do curl -o /dev/null --silent --head --write-out "%{http_code} $LINE\n" "$LINE"; done < todo | tee test_results.txt

I can't even find the solution on google or youtube.

CodePudding user response:

If you added #!/bin/bash to your script, then your cronjob should look like:

* * * * * ~/Desktop/abc.sh

Or

* * * * * /home/USER/Desktop/abc.sh

In the first case you have to run cronjob from the same user where of the Desktop folder.

CodePudding user response:

I posted the EXACT path to my abc.sh file. That's very important for cron to run it since it's not installed on the same place.

I also had to add "!#bin/bash" to my script.

  • Related