Files
org-roam/20230607103155-crontab.org
2025-11-05 09:18:11 +01:00

2.0 KiB

crontab

Crontab is a Unix command that creates a table or list of commands, each of which is to be executed by the operating systemt a specified time and on a regular schedule. Crontab is used to create the crontab file (the list) and later used to change the previously created crontab file.

A crontab is structured as follows: * * * * * command first *: min (0-59) second *: hour (0-23) third *: day (0-31) fourth *: month (1-12) fifth *: day of month (0-7) 0&7 are sunday

crontab-command

create a crontab

  crontab -e

list crontabs

  crontab -l #(as user or [[id:673d1cb1-536b-42f1-a046-40a8937c4283][root]])
  crontab -l -u smad user (user=smad)

before save a crontab a new line is added at the end of the script or the crontab will not be installed

on this cluster (all machines as root) crontab is used for doing:

autoupdate at 0:00 all 15th & 30th in a month with pacman

0 0 15,30 * * pacman -Syu --noconfirm

reboot after autoupdate (1) and that with each machine time-delayed

30 0 15,30 * * /sbin/shutdown -r now

wireguard down & up (one min before reboot) so that a permanent connection of the clients to the vpn server is guaranteed

29 0 * * * wg-quick down wg1 && wg-quick up wg1

on W0 and W10 (user=smad) for doing:

Backup

0 2 * * * /home/smad/backups/backup.sh