Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I only intended to run this script one time, but it runs every Tuesday for some reason. I have other machines with similarly narrowed down schedules and they work as expected.
I'm redirecting output to /dev/null to not receive an email. I know I can also use the MAILTO="" directive, but I'm pretty sure I've successfully used this method in the past.
there are a few problems:
you need to write redirection as:
03 20 08 05 2 root /root/script1.sh >/dev/null 2>&1 (this will redirect stderr to stdout and than stdout to /dev/null) otherwise you will redirect stdout to /dev/null and stderr to stdout.
The number 2 before root (fifth field) means you want to execute it on every Tuesday (see man page of crontab)
Your claims of other machines working as expected notwithstanding, the manpage for the crontab file (`man 5 crontab`) quite clearly states:
Quote:
Note: The day of a command’s execution can be specified by two fields — day of month, and day of week. If both fields are restricted (ie, aren’t *), the command will be run when either field matches the current time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.
Thank you gentlemen. Upon further examination, I do see that the other jobs I referenced as working as expected, were in fact running every week, I just didn't realize it because there was nothing for them to do during that time frame. This was a good lesson, my understanding of the crontab table format was incorrect, I thought all restricted (non *) fields had to match.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.