aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--user/monitoring.service20
1 files changed, 20 insertions, 0 deletions
diff --git a/user/monitoring.service b/user/monitoring.service
new file mode 100644
index 0000000..88da36b
--- /dev/null
+++ b/user/monitoring.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Monitoring tools in a separate tmux session
+After=network.target local-fs.target
+ConditionFileIsExecutable=/usr/bin/tmux
+ConditionFileIsExecutable=/usr/bin/htop
+ConditionFileIsExecutable=/usr/bin/glances
+ConditionFileIsExecutable=/usr/bin/loginctl
+
+[Service]
+Type=forking
+KillMode=control-group
+Environment=TMUX_TMPDIR=/run/user/%U/tmux
+ExecStart=/usr/bin/tmux -L mon new-session -d -s mon -n htop htop
+ExecStartPost=/usr/bin/tmux -L mon new-window -n glances glances
+ExecStartPost=/usr/bin/tmux -L mon new-window -n loginctl "watch -n1 loginctl user-status %U"
+ExecStop=/usr/bin/tmux -L mon kill-session -t mon
+Restart=on-failure
+
+[Install]
+WantedBy=default.target