sudo vim /etc/systemd/system/ping.service
Edit this file like this:
[Service]
ExecStart=/bin/ping google.com
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=ping-google
#WorkingDirectory=
[Install]
WantedBy=multi-user.target
sudo systemctl enable ping.service
or we can do it manually by creating a symlink:
sudo ln -s /etc/systemd/system/ping.service /etc/systemd/system/multi-user.target.wants/ping.service
Restart:
sudo systemctl daemon-reload
Check status of our daemon:
sudo systemctl status ping.service
See the output of our service:
sudo journalctl -u ping-google
- https://wiki.archlinux.org/index.php/Systemd/Timers
- http://blog.higgsboson.tk/2013/06/09/use-systemd-as-a-cron-replacement/