This commit is contained in:
45
Technical/Linux/Systemd Services.md
Executable file
45
Technical/Linux/Systemd Services.md
Executable file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
note type:
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
# To add a systemctl
|
||||
|
||||
- create a new systemd service file:
|
||||
`sudo nano /etc/systemd/system/name.service`
|
||||
|
||||
- example content:
|
||||
`[Unit]`
|
||||
`Description=Watch TODO Directory and Update Master Task List`
|
||||
`After=network.target`
|
||||
|
||||
`[Service]`
|
||||
`ExecStart=/usr/local/bin/watch-todo.sh`
|
||||
`Restart=always`
|
||||
`User=zaine`
|
||||
`WorkingDirectory=/home/zaine/master-folder/org<sub>files</sub>/todo`
|
||||
`StandardOutput=append:/var/log/watch-todo.log`
|
||||
`StandardError=append:/var/log/watch-todo.log`
|
||||
|
||||
\[Install\]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- reload and start:
|
||||
|
||||
`sudo systemctl daemon-reload`
|
||||
`sudo systemctl enable watch-todo.service`
|
||||
`sudo systemctl start watch-todo.service`
|
||||
|
||||
# To remove a systemctl service:
|
||||
|
||||
```
|
||||
systemctl stop \[servicename\]
|
||||
systemctl disable \[servicename\]
|
||||
rm *etc/systemd/system*\[servicename\]
|
||||
rm *etc/systemd/system*\[servicename\] \# and symlinks that might be related
|
||||
rm *usr/lib/systemd/system*\[servicename\]
|
||||
rm *usr/lib/systemd/system*\[servicename\] \# and symlinks that might be related
|
||||
systemctl daemon-reload
|
||||
systemctl reset-failed
|
||||
```
|
||||
Reference in New Issue
Block a user