Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 1.76 KB

systemd.md

File metadata and controls

58 lines (41 loc) · 1.76 KB

Notes - SystemD

Important note, the Environment=PATH=... does not interopolate other environment variables

# After installing config
sudo systemctl daemon-reload

# Show available units
sudo systemctl

sudo systemctl status tsdb-recorder.service
sudo systemctl restart tsdb-recorder.service
sudo systemctl show tsdb-recorder.service

# Logging
journalctl -u  tsdb-recorder.service

# To test systemd restarting
# sudo kill -KILL $(ps aux | grep record | head -n1 | tr -s ' ' | cut -d ' ' -f 2)


# Utilizations
systemd-cgtop -m

# Running services
systemctl -t service | grep -v systemd

# CSV format of unit,load,active,sub
systemctl -t service | tr -s ' ' | tr -d 'â—�' | awk '$1 ~ /^[a-z]/ {out=""; for(i=1;i<5;i++){out=out" "$i", "}; print out}'

# If you have a failed service you removed, it will stay until you run this
systemctl reset-failed

# Remove stopped 1 off jobs
sudo systemctl stop [email protected]

# Show the config for the service
sudo systemctl cat tsdb-recorder.service

systemctl --user list-timers

# Customize an existing services config
systemctl edit nginx.service

Timers