LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-06-2020, 02:39 AM   #1
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Rep: Reputation: Disabled
Cron cleared after every 5 days


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?

Thanks.
 
Old 04-06-2020, 03:50 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
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?
 
Old 04-06-2020, 08:36 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,742

Rep: Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982
Quote:
Originally Posted by dushyantg View Post
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??
 
Old 04-08-2020, 04:50 AM   #4
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
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.
 
Old 04-08-2020, 07:46 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,742

Rep: Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982
Quote:
Originally Posted by dushyantg View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Recreating the windows password after it is cleared by "chntpw" venkibellu Linux - Security 4 06-28-2016 06:48 PM
[SOLVED] Configured Cron job executed every hour is instead executed every minute for 10m markings Linux - Software 4 05-13-2012 05:43 PM
How to set up a Cron Job to run every other week or every three months etc. kckabobus Linux - Newbie 3 04-03-2008 01:36 PM
firefox accept cookies checkbox cleared after being checked and FF restarted" skaramanger Mandriva 0 05-10-2006 06:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration