From c9962e16c32638b7c5d0d9b326707ca720e01d25 Mon Sep 17 00:00:00 2001 From: crater2150 Date: Sun, 20 Aug 2023 17:30:41 +0200 Subject: [PATCH] new-service: optionally add logging with -l or --log --- new-service | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/new-service b/new-service index 5536ed6..32a7fa1 100755 --- a/new-service +++ b/new-service @@ -1,7 +1,15 @@ #!/bin/zsh +zparseopts -D l=logs -log=logs -enable-log=logs + mkdir $1 -ln -s /run/user/1000/supervise.$1/ $1/supervise +ln -s ${XDG_RUNTIME_DIR:-/run/user/$UID}/supervise.$1 $1/supervise echo '#!/bin/zsh' > $1/run echo "exec $*" >> $1/run chmod +x $1/run + +if [[ $logs ]]; then + mkdir $1/log + ln -sr ./log $1/log/run + ln -s ${XDG_RUNTIME_DIR:-/run/user/$UID}/supervise.${1}-log $1/log/supervise +fi