Created a Cron job, now my inbox is getting flooded
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.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Any output (on STDERR or STDOUT) from a cronjob gets emailed to you. What happening is cron is trying to run a command call root which is then failing. How have you been editing your crontab? With crontab -e? Typically each user has a crontab rather than a single large crontab that lists the users. What do you get when you run crontab -l (thats an lower case L by the way) as root?
I manually edited /etc/crontab using vi to add the job. when I use crontab -e, it appears to give me the exact same file that is in /etc/crontab. AFAICT, my script works perfectly. I can execute the script just fine manually.
It sounds like you have an error in the script that runs at the bottom and the output is causing cron to send you an email.
If this were the case, wouldn't the emails coming to me reference /home/php/parse/my_script1 rather than "root nice -19..."? And wouldn't they only come to me once a day rather than several time during the day? I'm not trying to shoot you down here because I genuinely do not know the answers to these questions.
I recon you want to run crontab -e and remove just have 00 5 * * * /home/php/parse/my_script1 in your user specific crontab.
Could you please clarify that a bit? Do I or don't I want anything but this line in crontab -e? This is a server that I am not logged into most of the time, so I want to make sure that it will still be run even if no users are logged in. Thanks for your help!
Cron is trying to execute a command named "root", which of course, doesn't exist. Try:
01 * * * * nice -n 19 run-parts /etc/cron.hourly
- On another matter of things, the execution of cron jobs always mails the user with the results, wherever it ends in success or not.
If you want it disabled, you have to define a environment variable MAILTO and leave it empty.
The easiest will be to add a line like this at the end of /etc/profile, or /root/.bashrc