Crontab in Jail help please

Status
Not open for further replies.

Chris230291

Patron
Joined
Mar 21, 2012
Messages
300
Hi. I am new to scripts and stuff.

I made a script called "run". If I run it manually it works. "./run.sh"
Now I am trying to make it run automatically every 1 mins. Google said to use the crontabs thing, so I added this to the Jail "/etc/crontab"

"*/1 * * * * root /usr/local/www/apache24/data/run.sh"

Maybe I am missing something obvious? Any help is appreciated.

Chris.
 

Chris230291

Patron
Joined
Mar 21, 2012
Messages
300
I found the problem and I feel stupid.
In my script (that generates files and messes with them) I didn't use full paths. So the cron was in fact running, but in the "wrong" directory. I fixed it by doing this in the cron entry

"cd /usr/local/www/apache24/data/ && ./run.sh"
 

Brer

Explorer
Joined
Mar 2, 2017
Messages
63
People forget that root is actually a user and has a user directory of its own, you are not the only one who has fallen fowl to this simple but very perplexing mistake.
 
Status
Not open for further replies.
Top