LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2016, 07:50 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
Learning cron : CentOS7 : anacron and cron


Both anacron and cron are up, but in sleep at this point:

Code:
[user1@server1 cron.hourly]$ ps aux | grep -i anacron
root      4261  0.0  0.0 123308   740 ?        Ss   12:01   0:00 /usr/sbin/anacron -s
user1     5084  0.0  0.0 112648   948 pts/0    R+   12:24   0:00 grep --color=auto -i anacron
[user1@server1 cron.hourly]$ ps aux | grep -i crond
root      1331  0.0  0.1 126332  1660 ?        Ss   11:42   0:00 /usr/sbin/crond -n
user1     5089  0.0  0.0 112648   948 pts/0    R+   12:24   0:00 grep --color=auto -i crond
From man anacron page"
Code:
DESCRIPTION
       Anacron  is  used  to  execute  commands periodically, with a frequency
       specified in days.  Unlike cron(8), it does not assume that the machine
       is  running  continuously.   Hence, it can be used on machines that are
       not running 24 hours a day to control regular jobs  as  daily,  weekly,
       and monthly jobs.

       Anacron  reads  a  list  of jobs from the /etc/anacrontab configuration
       file (see anacrontab(5)).  This file contains the  list  of  jobs  that
       Anacron  controls.   Each job entry specifies a period in days, a delay
       in minutes, a unique job identifier, and a shell command.

       For each job, Anacron checks whether this job has been executed in  the
       last  n  days, where n is the time period specified for that job.  If a
       job has not been executed in n days or more,  Anacron  runs  the  job's
       shell command, after waiting for the number of minutes specified as the
       delay parameter.

       After the command exits, Anacron records the date (excludes  the  hour)
       in  a  special timestamp file for that job, so it knows when to execute
       that job again.
And from man cron page:

Code:
DESCRIPTION
.......In case systemd is enabled, then  unit  file
       is  installed  into  /lib/systemd/system/crond.service  and  daemon  is
       started by systemctl start crond.service command.  It  returns  immedi‐
       ately,  thus, there is no need to need to start it with the '&' parame‐
       ter.

       Cron searches /var/spool/cron for crontab files which are  named  after
       accounts in /etc/passwd; The found crontabs are loaded into the memory.
       Cron also searches for /etc/anacrontab and any files in the /etc/cron.d
       directory,  which have a different format (see crontab(5)).  Cron exam‐
       ines all stored crontabs and checks each job to see if it needs  to  be
       run  in  the  current  minute.   When executing commands, any output is
       mailed to the owner of the crontab (or to the  user  specified  in  the
       MAILTO  environment  variable in the crontab, if such exists).  Any job
       output can also be sent to syslog by using the -s option.

Since cron and anacron also checks /etc/anacrontab,
Q1: How do they resolve not executing /etc/anacrontab twice?

Q2: I am not able to find how anacron was started using: systemctl --all.

How do I find out how anacron was started and by who?
man anacron did not help much.

Thanks.

Last edited by fanoflq; 11-24-2016 at 08:03 PM.
 
Old 11-24-2016, 09:31 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,128

Rep: Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076
anacron is not a service and is started by cron.


https://www.certdepot.net/rhel7-how-...arted-anacron/
 
1 members found this post helpful.
Old 11-24-2016, 09:50 PM   #3
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
anacron is not a service and is started by cron.


https://www.certdepot.net/rhel7-how-...arted-anacron/
Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
understanding anacron (with/without cron) vincix Linux - Newbie 2 07-09-2015 02:55 PM
KERNEL PANIC when cron/anacron is runnig antoniusEde Debian 2 04-07-2010 07:00 PM
Anacron job 'cron.daily' cccc Debian 15 05-20-2008 12:39 PM
Cron/Anacron Not Working - Debian Sarge br00tal Debian 2 10-10-2005 06:41 PM
cron / anacron / fcron Will Linux - General 3 11-09-2001 01:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:28 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