Crontab not working D:
2 minutes ago, JessicaH said:My top gotcha: If you forget to add a newline at the end of the
crontab
file. In other words, the crontab file should end with an empty line.I AM 50% SURE THIS IS THE PROBLEM
Good catch, I'll try to explain my stuff none the less, maybe it'll help you in the future.
You know what the stars do, just to make sure we're on the same page here: the stars specify the interval which in your case is every minute.
Now, since a .sh file is just a file containing shell commands you need an actual shell to execute the file. It's the same as for .py files where you need the python interpreter. Most of the time the system knows how to execute a .sh file (by passing it to sh (the standard shell), bash or zsh), but under certain circumstances it will not know how to run the file since it's not a native ELF binary. In this case you just point to the binary (the shell in our case) and give it the file path to execute.
So what I did was instead of calling the .sh file directly I called the shell with /usr/bin/sh and supplied the sh script as first parameter to make sure the correct shell is spawned and the script is actually executed.
For the redirect stuff I'll just redirect you to this very good answer: http://unix.stackexchange.com/questions/163352/what-does-dev-null-21-mean-in-this-article-of-crontab-basics
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now