autoinstall with cron or systemd-timer
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? -- Mit freundlichen Gruessen, Andreas Vetter
Am 22.01.21 um 09:33 schrieb Andreas Vetter:
Hi *, I did not find a way to install cronjobs for root in the autoyast docu.
Hi, yes you right. As there is no YaST module for configurate jobs there is also no AY implementation available. But you can use the post install script section to establish such kind of jobs. The way how you do it...hm, perhaps someone else here has a nice idea :-) Greetings Stefan
-- ******************************************************************************* Stefan Schubert e-mail: schubi@suse.de ------------------------------------------------------------------------------- SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 Nürnberg Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
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.
participants (3)
-
Andreas Vetter
-
Carsten Dumke
-
Stefan Schubert