forked from ungleich-public/cdist
new type: __daemontools_service
This commit is contained in:
parent
1322e85eac
commit
cf0ab2a5bd
6 changed files with 37 additions and 0 deletions
31
cdist/conf/type/__daemontools_service/manifest
Normal file
31
cdist/conf/type/__daemontools_service/manifest
Normal 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 "-"
|
|
@ -0,0 +1 @@
|
|||
multilog t ./main
|
|
@ -0,0 +1 @@
|
|||
/service
|
4
cdist/conf/type/__daemontools_service/parameter/optional
Normal file
4
cdist/conf/type/__daemontools_service/parameter/optional
Normal file
|
@ -0,0 +1,4 @@
|
|||
log-run
|
||||
run
|
||||
run-file
|
||||
servicedir
|
Loading…
Reference in a new issue