Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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 have created a cron job which executes every 3 mins. its working fine after starting for 5 days than it automatically got stopped. when I checked crontab it was blank.
my crontab is like below
*/3 * * * * /home/test.sh
It is working continuous 5 days and that got stopped automatically and line which I have added in crontab
"*/3 * * * * /home/test.sh" is not there.
I see two interesting paragraphs in the manual page.
Quote:
There are two ways how changes in crontables are checked. The first
method is checking the modtime of a file. The second method is using
the inotify support. Using of inotify is logged in the /var/log/cron
log after the daemon is started. The inotify support checks for
changes in all crontables and accesses the hard disk only when a
change is detected.
If cron can be notified with inotify, so can you.
And the debug flags:
Quote:
crond -x [ext,sch,proc,pars,load,misc,test,bit]
I am not sure what they mean, but perhaps you can find out?
Hi
I have created a cron job which executes every 3 mins. its working fine after starting for 5 days than it automatically got stopped. when I checked crontab it was blank.
my crontab is like below
*/3 * * * * /home/test.sh
It is working continuous 5 days and that got stopped automatically and line which I have added in crontab
"*/3 * * * * /home/test.sh" is not there.
there is no error in cron logs too. Please suggest/guide me what should I do?
First, you are not providing any details that would clarify things. What version/distro of Linux? What is actually IN that test.sh file? And does this have anything to do with your other cron thread? https://www.linuxquestions.org/quest...on-4175669153/
Messing with permissions/attributes on system-level things (like cron), isn't a good idea. And just reading your question tells you the answer...you say yourself that the line you added **WAS MISSING FROM CRON**. That would certainly explain why the job isn't running, wouldn't it??
First, you are not providing any details that would clarify things. What version/distro of Linux? What is actually IN that test.sh file? And does this have anything to do with your other cron thread? https://www.linuxquestions.org/quest...on-4175669153/
Messing with permissions/attributes on system-level things (like cron), isn't a good idea. And just reading your question tells you the answer...you say yourself that the line you added **WAS MISSING FROM CRON**. That would certainly explain why the job isn't running, wouldn't it??
I am using CentOS 7. yes lines were automatically get wiped after every 5 days. when my DB was down and I have check the status of crontab it was not having the lines which I have added there. after that I have checked cron logs but it was not having any details or error related to that.
I am using CentOS 7. yes lines were automatically get wiped after every 5 days. when my DB was down and I have check the status of crontab it was not having the lines which I have added there. after that I have checked cron logs but it was not having any details or error related to that.
So we're back to the obvious answer to your initial question: the cron job didn't run because **IT WAS NOT THERE**. And the only way that can happen is if someone deleted the jobs. Even doing a system update won't erase a crontab file.
You haven't said whether this relates to your other cron related thread or not (mentioned previously), or why you were messing with attributes/permissions on a system level thing like cron. You also haven't said what's in that shell script you're running either. Is this CentOS machine real or virtual? Hosted? Updated recently? Restating your question doesn't provide new information.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.