• Systemd Timers
    • Timer Configuration Options


      OptionDescription
      OnCalendarDefines a real-time schedule for the timer (e.g., daily, weekly).
      OnBootSecSpecifies a delay after system boot before the timer activates.
      OnUnitActiveSecSets a timer based on the last activation of the associated service.
      OnUnitInactiveSecTriggers the timer based on the last deactivation of the associated service.
      PersistentEnsures the timer runs immediately if the system was off during the scheduled time.
    • Example Usage


      To create a timer, you need two files: a service file and a timer file. For instance, to run a backup script daily at 1 AM, you would create:

      Backup Service File (/etc/systemd/system/backup.service):

      	  [Unit]
      	  Description=Daily Backup Service
      
      	  [Service]
      	  ExecStart=/path/to/backup.sh
      	  Type=oneshot
      					


      Backup Timer File (/etc/systemd/system/backup.timer):

      	  [Unit]
      	  Description=Daily Backup Timer
      
      	  [Timer]
      	  OnCalendar=*-*-* 01:00:00
      	  Persistent=true
      
      	  [Install]
      	  WantedBy=timers.target