new type: __daemontools_service

This commit is contained in:
kamila 2017-05-29 16:23:24 +02:00
parent 1322e85eac
commit cf0ab2a5bd
6 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,31 @@
#!/bin/sh
RUN_PREFIX="#!/bin/sh
exec 2>&1
exec " # mind the space :D
name=$__object_id
servicedir=$(cat "$__object/parameter/servicedir")
run=$(cat "$__object/parameter/run")
runfile=$(cat "$__object/parameter/run-file")
logrun=$(cat "$__object/parameter/log-run")
badusage() {
echo "__daemontools_service/$__object_id: exactly one of --run, --run-file must be set" >&2
exit 1
}
[ -z "$run$runfile" ] && badusage
[ -n "$run" ] && [ -n "$runfile" ] && badusage
__directory $servicedir/$name/log/main --parents
echo "$RUN_PREFIX$run" | require="__directory/$servicedir/$name/log/main" __config_file "$servicedir/$name/run" \
--onchange "svc -t '$servicedir/$name' 2>/dev/null" \
--mode 755 \
--source "${runfile:--}"
echo "$RUN_PREFIX$logrun" | require="__directory/$servicedir/$name/log/main" __config_file $servicedir/$name/log/run \
--onchange "svc -t '$servicedir/$name/log' 2>/dev/null" \
--mode 755 \
--source "-"

View file

@ -0,0 +1 @@
multilog t ./main

View file

@ -0,0 +1 @@
/service

View file

@ -0,0 +1,4 @@
log-run
run
run-file
servicedir