DomainPunch Logo

 A Service of Softnik Technologies

Using systemd timer

You may also use cron instead of systemd.

What is systemd?

systemd timer units are used for scheduling jobs on Linux. You can run jobs can be based on the time and date or on events.

Using systemd instead of cron

You will need to create two files, one for the systemd service and another for the timer. Please edit the paths as required in the examples shown below.

/etc/systemd/system/wmdsed.service

[Unit]
Description=wmdsed

[Service]
Type=oneshot
ExecStart=php /var/www/html/wmdsed60/cron.php
WorkingDirectory=/var/www/html/wmdsed60/

/etc/systemd/system/wmdsed.timer

[Unit]
Description=wmdsed

[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true

[Install]
WantedBy=timers.target

Start and enable the timer

sudo systemctl start wmdsed.timer
sudo systemctl enable wmdsed.timer
Close