new-service: optionally add logging with -l or --log
This commit is contained in:
parent
3a5dc24f75
commit
c9962e16c3
10
new-service
10
new-service
|
@ -1,7 +1,15 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
|
zparseopts -D l=logs -log=logs -enable-log=logs
|
||||||
|
|
||||||
mkdir $1
|
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 '#!/bin/zsh' > $1/run
|
||||||
echo "exec $*" >> $1/run
|
echo "exec $*" >> $1/run
|
||||||
chmod +x $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
|
||||||
|
|
Loading…
Reference in a new issue