diff options
Diffstat (limited to 'contrib/hls/create-runit-conf.sh')
-rwxr-xr-x | contrib/hls/create-runit-conf.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/hls/create-runit-conf.sh b/contrib/hls/create-runit-conf.sh new file mode 100755 index 0000000..4d43282 --- /dev/null +++ b/contrib/hls/create-runit-conf.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo "Usage $0 <name>" + exit 1 +fi + +name=$1 +OUT_D=runit + +rm -rf "$OUT_D" +mkdir -p "$OUT_D" + +for src in av-orig av-en; do + for profile in low medium high; do + echo "creating runit instance for $src - $profile" + DIR="$OUT_D/hls-$name-$src-$profile" + mkdir -p "$DIR/log" +cat >> "$DIR/run" <<EOF +#!/bin/sh +set -e + +exec 2>&1 +exec chpst -u flumotion:flumotion /usr/local/bin/start-hls.sh "$name" "$src" "$profile" +EOF + chmod +x "$DIR/run" + +cat >> "$DIR/log/run" <<EOF +#!/bin/sh +set -e + +LOG_D="/var/log/hls-$name/$src-$profile/" +if [ ! -d "\$LOG_D" ]; then + mkdir -p -m0750 "\$LOG_D" +fi +chown root:adm "\$LOG_D" +exec chpst -u root:adm svlogd -tt "\$LOG_D" +EOF + chmod +x "$DIR/log/run" + + ln -s "/var/run/sv.hls-$name-$src-$profile" "$DIR/supervise" + ln -s "/var/run/sv.hls-$name-$src-$profile.log" "$DIR/log/supervise" + + done +done |