new-service: add import-env support
This commit is contained in:
parent
1f44d351ed
commit
684ed6f515
2 changed files with 18 additions and 6 deletions
12
new-service
12
new-service
|
@ -1,11 +1,17 @@
|
|||
#!/bin/zsh
|
||||
|
||||
zparseopts -D l=logs -log=logs -enable-log=logs
|
||||
zparseopts -D l=logs -log=logs -enable-log=logs i:=importenv -import-env:=importenv
|
||||
|
||||
mkdir $1
|
||||
ln -s ${XDG_RUNTIME_DIR:-/run/user/$UID}/supervise.$1 $1/supervise
|
||||
echo '#!/bin/zsh' > $1/run
|
||||
echo "exec $*" >> $1/run
|
||||
{
|
||||
echo '#!/bin/zsh'
|
||||
if [[ $importenv ]]; then
|
||||
echo 'source ${0:a:h:h}/import-env.zsh'
|
||||
echo "import-env ${importenv[2]}"
|
||||
fi
|
||||
echo "exec $*"
|
||||
} > $1/run
|
||||
chmod +x $1/run
|
||||
|
||||
if [[ $logs ]]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue