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'm trying to change the times for the cronjobs daily and hourly...
hourly starts every hour at Minute 01.
And Daily at 03:17 AM.
But my crontab is empty at this time.
And anacron looks this:
###############################################################
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 9 cron.daily nice run-parts /etc/cron.daily
7 55 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
###############################################################
When I configure a crontab, then the daily and hourly parts are startet twice at the specified time, too...?
Can anyone give me help?
Anacron runs separately from a cronjob and regardless of when the computer is powered on. A daily job can run anytime the computer is on from 0300 - 2200.
I will change the time because I'm resetting some things, for example the internetconnection.
and I will understand how the crontab works.
I'm sure this had worked. but now the times I configured in the crontab are ignored?
How are you accessing/editing the crontab?
If with crontab -e , you’re working with the user’s crontab…be that your user or root. I do all my server-side crontab maintenance as root…so su - to root and then crontab -e
There may also be entries in /etc/ crontab and maybe /etc/cron.d/* On my server, rsnapshot updated /etc/crontab
So, crontab for each user, and, maybe, system-wide crontab configs
PS. I also disabled anacron on the server…if it’s not up, I’ve got bigger problems than a missed cron job
I'm running CENTOS 7.
This is an server, which is runnung 24/7.
So I think anacron isn't necessary or? Because it runs only when the computer starts...
I've only configured the /etc/crontab.
I've checked crontab for every user, inclusive root. nothing in.
And when I put an empty crontab (remove /etc/crontab and "touch /etc/crontab"), then the hourly job runs every "01 Minute" at full hour.
When I configure the /etc/crontab, the hourly jobs are running in addition to the "01 Minute", so here at Minute 17.
I've no idea where the 2nd time is comming...
Like here:
(from the /var/log/cron)
Jan 19 14:01:01 blobbm CROND[3626]: (root) CMD (run-parts /etc/cron.hourly)
Jan 19 14:17:01 blobbm CROND[4166]: (root) CMD ( run-parts /etc/cron.hourly)
I’m guessing the that the second (:01) run is from anacron…had double runs on my CentOS 7 server too.
I shut down (disabled) anacron and that stopped.
I don’t think it only runs at startup/boot, but I’ve not dug into it…as I said, if the server is not running I’ve got way bigger problems than missed cron jobs…
So, I took the quick (lazy) way out and disabled anacron, which made all the duplicate runs go away.
I guess my advice is to grok how anacron works…or not…
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.