user3938558
user3938558

Reputation: 63

simple crontab not running

I've searched through several forums, but cannot find anything that suggests that my cron job is incorrect. I have a .sh script that runs a python script, and I want my cron job to run that .sh script every minute. I have my email entered, but so far nothing proves that the job is running.

Here is my cronjob:

    #!/bin/bash
    [email protected]

    * * * * * /home/somedir/anotherdir/bash_scripts/script.sh

The script "script.sh" runs correctly when I run it at the command line. The cron job is currently in the same folder. I have a feeling this is incorrect. Any suggestions? Thank you!!!

Upvotes: 0

Views: 171

Answers (1)

bryn
bryn

Reputation: 3325

Your entry should probably look like this:

[email protected]
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin

* * * * * /home/somedir/anotherdir/bash_scripts/script.sh

...PATH is just a guess. You can replace it with the output you get when running this in your shell:

echo $PATH

As already explained in comments PATH needs to be set so that the commands run in your script works without their full path.

Upvotes: 1

Related Questions