Untitled

 avatar
Lattuse
plain_text
9 months ago
530 B
17
Indexable
nano /home/student/hello.sh


#!/bin/bash
echo "[$(date)] Hello from custom service!" >> /home/student/hello.log


chmod +x /home/student/hello.sh


sudo nano /etc/systemd/system/hello.service


[Unit]
Description=Custom Hello Service

[Service]
ExecStart=/home/student/hello.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target


sudo systemctl daemon-reload
sudo systemctl enable hello.service
sudo systemctl start hello.service


sudo journalctl -u hello.service
cat /home/student/hello.log
Editor is loading...
Leave a Comment