linux systemd_ex

create a service file.
cp /lib/systemd/system/crond.service \ /lib/systemd/system/sleep.service

edit the service file.

vi /lib/systemd/system/sleep.service

[Unit]
Description=sleep service
[Service]
ExecStart=/usr/sbin/sleep.sh
KillMode=process

[Install]
WantedBy=multi-user.target

create a script to be executed.

vi /usr/sbin/sleep.sh
#!/usr/bin/bash
sleep 1000

make the script executable

chmod +x /usr/sbin/sleep.sh

enable the service.
systemctl enable sleep.service

start the service.
systemctl start sleep.service

check status.
systemctl status sleep.service

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.