If package wants to use rsyslog as an additional optional syslog solution it also needs to contain an rsyslog conf file.

+

The file name of a cron job file should match the name of the package from which it comes.

−

Each rsyslog file must end with the filename .conf. It must be placed /etc/rsyslog.d/ directory and must have 0644 filepermission and be owned by root.

+

If a package supplies multiple cron job files files in the same directory, the file names should all start with the name of the package (possibly modified as described below) followed by a hyphen (-) and a suitable suffix.

−

Here is an examples of rsyslog file.

+

A cron job file name must not include any period or plus characters (. or +) characters as this will cause cron to ignore the file. Underscores (_) should be used instead of . and + characters.

Fedora Cron Job Files

This document describes the guidelines for packaging cron job file(s), in Fedora.

For the purposes of these guidelines, a cron job file is defined as an script (e.g., shell scripts or Perl scripts).

If your package requires regularly scheduled tasks to operate properly and does not ship systemd unit file, you can use those files to set that up.

Cron Job Files on the filesystem

Packages with cron job files must be placed respectfully into one or more of the following directories /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly depending on the intended interval they should run.

If a certain cron job has to be executed at some frequency or at a specific time interval other then the above, that cron job file should be placed in /etc/cron.d directory.

All files installed in any of these directories must be scripts and must be treated as configuration files so that they can easily be modified by the local system administrator.

Logrotate file

If a package contains a logfile then it needs to also include a properly installed logrotate file.

Each logrotate file must end with the filename .conf. It must be placed /etc/logrotate.d/ and must have 0644 filepermission and be owned by root.

Here are examples of an logrotate file.

Example minimal logrotate file

/var/log/example/*log {
missingok # If the log file is missing, go on to the next one without issuing an error message
notifempty # Don't do any rotation if the logfile is empty
compress # Compress older files with gzip
delaycompress # Don't compress yesterdays files
}

Example minimal logrotate log file with user create mode

/var/log/example/*log {
missingok # If the log file is missing, go on to the next one without issuing an error message
notifempty # Don't do any rotation if the logfile is empty
compress # Compress older files with gzip
delaycompress # Don't compress yesterdays files
create 640 owner group # Set create mode immediately after rotation
}

Example minimal logrotate file with daemon restart

/var/log/example/*log {
missingok # If the log file is missing, go on to the next one without issuing an error message
notifempty # Don't do any rotation if the logfile is empty
compress # Compress older files with gzip
delaycompress # Don't compress yesterdays files
sharedscripts # Scripts are only run once for all files in directory
postrotate
/usr/bin/systemctl restart example.service 2>/dev/null || true
endscript
}

/var/log/example/*log {
missingok # If the log file is missing, go on to the next one without issuing an error message
notifempty # Don't do any rotation if the logfile is empty
compress # Compress older files with gzip
delaycompress # Don't compress yesterdays files
create 640 owner group # Set create mode immediately after rotation
sharedscripts # Scripts are only run once for all files in directory
postrotate
/usr/bin/systemctl restart example.service 2>/dev/null || true
endscript
}

Debugging logrotate fileYou can debug your logrotate file by running

# logrotate -d -f /etc/logrotate.d/example.conf

from the command line.

Cron job file names

The file name of a cron job file should match the name of the package from which it comes.

If a package supplies multiple cron job files files in the same directory, the file names should all start with the name of the package (possibly modified as described below) followed by a hyphen (-) and a suitable suffix.

A cron job file name must not include any period or plus characters (. or +) characters as this will cause cron to ignore the file. Underscores (_) should be used instead of . and + characters.

Log Files Packaging

If an package is going to provide additional optional syslog support then they must be placed into a separate $name-<syslogging option> subpackage as in $name-rsyslog or $name-syslog-ng