leeand00's picture

Is there any documentation about the cron jobs installed in TurnKey Core and any application specific cron jobs?

I went through the list of them on my TKL 13 Moodle VM and found the following cron jobs:

(Note, the times have been adjusted for my timezone from the UTC one that the webserver is set on...)

1:25 PM
/etc/cron.daily/passwd
/etc/cron.daily/ntp
/etc/cron.daily/logrotate
/etc/cron.daily/apache2
/etc/cron.daily/man-db
/etc/cron.daily/apt
/etc/cron.daily/mysqloptimize
/etc/cron.daily/dpkg
/etc/cron.daily/bsdmainutils
/etc/cron.daily/tklbam-backup
/etc/cron.daily/etckeeper

1:45 PM
/etc/cron.weekly/man-db

On the 17th minute of the hour:
/etc/cron.hourly/moodle
/etc/cron.hourly/hubdns-update

9th minute and on the 39th minute of every hour:
(session clean up?)
[ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -ignore_readdir_race -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete

-x /usr/lib/php5/maxlifetime (this is a script)


2:23 PM
test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt

Thank you,

    leeand00

 

Forum: 
Jeremy Davis's picture

IIRC even the TurnKey related ones come from TurnKey packages. Glancing at your list the TurnKey specific ones that jump out are:
  • tklbam-backup (but IIRC comes from the TKLBAM package)
  • moodle (comes from the Moodle overlay
  • hubdns-update (again IIRC comes from hub-dns package)
  • cron-apt; cron-apt is a Debian package but TurnKey leverages it to do the auto updates - see the config code here).

    /usr/lib is handled by package management so I'd expect that the "maxlifetime" one is a component of the php5 package (or one of the many modules). As for the others it should be fairly self explanatory where they come from.

  • leeand00's picture

    Now it appears that the timezone for these jobs to run is GMT-0 (by default?) are these jobs meant to be run when nobody is on the system?  Our server runs from a very specific timezone, so we have a pretty good hold on when our users will be accessing it.  Does it make sense to switch the times for the cron jobs to run to be when our users are sleeping?
     

    Jeremy Davis's picture

    Actually you raise a really good point that I hadn't really considered...

    Unless you set the timezone, your server will default to UTC/GMT. But by default the daily cron jobs are generally configured to run during the night. Not that it should be a huge issue; but it makes sense for the cron jobs to run when the system load is lowest.

    So the first step IMO would be to set your timezone. It's a really old blog post but should still be relevant. If you have issues, please post back here and I'll try to help out.

    leeand00's picture

    You have to be careful when you do that, don't you?  I mean the application that I have sitting on top of it will get all confused right?  Or am I wrong about that?  People do move servers to different timezones...oh I guess this is another question....

    Also, can you preset the timezone of the server using preseeding?

    Jeremy Davis's picture

    PHP has it's own settings (although IIRC if it hasn't been set, it defaults to the system time). Applications often have their own timezone setting config too.

    Because of the way Linux does things; when you set the timezone; it still uses UTC at a system level; it just shows you your local timezone info. AFAIK it makes both available to apps. That is why you often need to set timezone in applications themselves as well as system (although most Linux desktop apps just default to system).

    I would guess that to make everything work how you want it; you may also need to adjust timezone config on your apps (if they are relying on system default and haven't been individually been configured).

    Like anything that you tweak on your servers; best practice is to never touch any config unless you 100% know the outcome and/or have a known good (i.e. tested) current system-wide backup (e.g. TKLBAM).

    Having said that, it is not uncommon for servers to just use UTC. So just moving the cron jobs might be a better way to go in this instance?

    As for pre-seeding, AFAIK it isn't possible to preseed. However it can be scripted (see here).

    Add new comment