Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fcron system-crontab
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1776
Location: PB, Germany

PostPosted: Tue Jan 16, 2018 1:32 pm    Post subject: fcron system-crontab Reply with quote

Hi,

I wrote to the fcron mailinglist, but this was very Gentoo specific, so they told me to forward that to Gentoo here...
Alas there is currently no archive for the fcron mailinglist as gmane.org is down.

I'm a fcron user on Gentoo Linux for many years now. Though some things are
still unclear, that is how systab is used.

On Gentoo there is a USE flag system-crontab:

Code:
+ + system-crontab :
Set up fcron to respect /etc/crontab and /etc/cron.d. If this flag is disabled,
/etc/cron.d and /etc/crontab will be ignored, but
/etc/cron.hourly,daily,weekly,monthly} will still be respected.

This is enabled by default.

However beside my root crontab I always had my custom systab:

Code:
# fcrontab -u systab -l
%hourly,first(5),lavg1(5),until(30),nolog           *      run-parts /etc/cron.hourly
%daily,first(1h15),lavgand,lavg(5,5,5),until(6h)    * *    run-parts /etc/cron.daily
%weekly,first(2h30),lavgand,lavg(5,5,5),until(3d)   * *    run-parts /etc/cron.weekly
%monthly,first(3h45),lavgand,lavg(5,5,5),until(5d)  * * *  run-parts /etc/cron.monthly


Now if fcron really respects /etc/crontab, that would mean the cron.hourly...
jobs are all run twice?
Code:
# cat /etc/crontab
# /etc/crontab:
# This is fcron's special systab and *not* root's crontab!

# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# "run-crons" from sys-process/cronbase package doesn't allow selective
# runs like "run-parts" from sys-apps/debianutils. So every time
# "run-crons" gets executed it loops through
# /etc/cron.{hourly,daily,weekly,monthly} and executes one after another if
# lastrun lock file isn't in place.
# Without fcron's "serial(true)" option it would be possible that a lastrun
# lock file which should have been removed still exists when "run-crons"
# starts so that a promptly execution of all cronjobs isn't always
# guaranteed.

!serial(true)
00   *    *    *    *     /bin/rm -f /var/spool/cron/lastrun/cron.hourly
00   00   *    *    *     /bin/rm -f /var/spool/cron/lastrun/cron.daily
00   00   *    *    6     /bin/rm -f /var/spool/cron/lastrun/cron.weekly
00   00   1    *    *     /bin/rm -f /var/spool/cron/lastrun/cron.monthly
*/10 *    *    *    *     /usr/bin/test -x /usr/sbin/run-crons &&
/usr/sbin/run-crons
!serial(false)


However if those jobs are added twice I would see those duplicates in fcrondyn,
but I don't:
Code:

# fcrondyn -x ls |grep systab
0    |systab   |2018-01-11 10:00|run-parts /etc/cron.hourly
1    |systab   |2018-01-12 00:00|run-parts /etc/cron.daily
2    |systab   |2018-01-15 00:00|run-parts /etc/cron.weekly
3    |systab   |2018-02-01 00:00|run-parts /etc/cron.monthly


And even when disabling the Gentoo USE flag system-crontab, the description says
it would ignore /etc/cron.d and /etc/crontab, but still respect
/etc/cron.hourly,daily,weekly,monthly}. This makes it even more confusing,
because if true the hourly.. scripts would be currently run 3 times.
1. by my systab
2. by /etc/crontab using /usr/sbin/run-crons
3. by respecting /etc/cron.hourly,daily,weekly,monthly} internally.
_________________
HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1776
Location: PB, Germany

PostPosted: Tue Jan 16, 2018 1:38 pm    Post subject: Reply with quote

Code:
# fcrondyn -x ls |grep daily
1    |systab   |2018-01-17 00:00|run-parts /etc/cron.daily
So it seems I have added cron.daily only once.
It seems this entry was originated by my
# fcrontab -u systab -l

It seems that /etc/crontab was ignored eventhough I have system-crontab enabled on Gentoo.
_________________
HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1776
Location: PB, Germany

PostPosted: Fri Jan 19, 2018 8:25 am    Post subject: Reply with quote

Added some backlog from the mailinglist, as there is no archive currently:
On 18/01/18 07:10, Massimo B. wrote:
Then I found another crontab at least on Gentoo:

# cat /etc/fcron/fcrontab
# Script for checking system crontabs and creating the fcron systab.
# Runs every 10 minutes, does not mail output, doesn't log job runs
# except for errors.
@mail(false),nolog(true) 10 /usr/libexec/check_system_crontabs -s 0

What does this do? I don't see this job either in fcrondyn -x ls.

On Thu, 2018-01-18 at 21:36 +0000, Thibault Godouet wrote:
That's a script included in the fcron source code:

# Script to check and see if any system (f)crontabs have changed, and if so
# build a fcrontab file from /etc/crontab, /etc/fcrontab and files from
# /etc/cron.d/ and notify fcron about the change.

It looks like the Gentoo packager chose to schedule that script from
fcron itself. However if you don't see it in the output of 'sudo
fcrondyn -x ls' then something looks wrong.

Might be worth saving your (f)crontabs and moving them away, then trying
to reinstall the package. You could then see if that script is
scheduled by fcron by default, and add your jobs back.

_________________
HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1776
Location: PB, Germany

PostPosted: Fri Jan 19, 2018 8:32 am    Post subject: Reply with quote

As I don't see any part of /etc/crontab, /etc/fcron/fcrontab or /etc/cron.d in my fcrondyn -x ls, the Gentoo installation of fcron seems to ignore all those.
As most packages are placing their cronjobs in /etc/cron.{hourly,daily,weekly,monthly}/ I guess I'm fine with my custom systab:
Code:
# fcrontab -u systab -l
2018-01-19 09:29:51  INFO listing systab's fcrontab
!mail(false),lavg(6,6,6),lavgor

%hourly,first(5),lavg15(0),until(30),nolog      *       run-parts /etc/cron.hourly
%daily,first(1h15),until(6h)                    * *     run-parts /etc/cron.daily
%weekly,first(2h30),until(3d)                   * *     run-parts /etc/cron.weekly
%monthly,first(3h45),until(5d)                  * * *   run-parts /etc/cron.monthly

Still it is unclear why this useflag has no effect while being enabled:
Code:
 + + system-crontab : Set up fcron to respect /etc/crontab and /etc/cron.d. If this flag is disabled, /etc/cron.d and /etc/crontab will be ignored, but
                      /etc/cron.{hourly,daily,weekly,monthly} will still be respected.

For my case I would rather like to disable that anyway.
The only missed crontab I can see currently is /etc/cron.d/sysstat coming from app-admin/sysstat.

-> Bug 645012 - sys-process/fcron-3.2.1-r2: USE="system-crontab" does not work
_________________
HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1776
Location: PB, Germany

PostPosted: Fri Jan 19, 2018 9:55 am    Post subject: Reply with quote

Ok, that all seems to be a missing emerge --config here, and the hint is only shown at first installation.
I guess I'm going to switch to the generated systab instead of maintaining my own, though I'm able to do some loadbalancing with my custom systab.
_________________
HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 713
Location: Barcelona, Spain

PostPosted: Sun Jan 10, 2021 12:26 am    Post subject: Reply with quote

Thanks a lot for the detailed explanations! :D

I was having the same issue, and it has been solved by:

Code:
emerge --config sys-process/fcron


The files /etc/crontab and /etc/fcron/fcrontab are included in the systab user, as shown by this command:

Code:
fcrontab -u systab -l


Many thanks! :D
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved.
Take care of the community answering unanswered posts.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum