Am 22.01.2021 um 09:33 schrieb Andreas Vetter:
Hi *, I did not find a way to install cronjobs for root in the autoyast docu.
Since execution time matters in this case, /etc/cron.daily/ is not the way to go.
Installing a complete crontab for root would be a way, but may be a problem when one has to combine several entries on the fly. Anyone using that?
So i tend to use a systemd-timer, but that needs 3 files: The timer, the service and the actual script to run.
What do others use?
Hi, an easy way to inject crontabs is the /etc/cron.d directory. A file can be injected like described here: https://doc.opensuse.org/projects/autoyast/#id-1.9.4.2.36.9 or using a postinstall script (which is the way, we use). example (for a root-crontab we use): <files config:type="list"> <file> <file_path>/etc/cron.d/backup_helper</file_path> <file_contents> <![CDATA[ # crontab for backup-helper SHELL=/bin/sh PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/local/bin MAILTO="" # trigger backup-helper (daily at 21:05) 5 21 * * * root /usr/local/bin/backup-helper.sh ]]> </file_contents> </file> <file> <file_path>/etc/cron.d/</file_path> <!-- create directory --> </file> </files> Best regards Carsten PS: After manually putting files into /etc/cron.d the crond must be reloaded.