common (495B)
1 #!/bin/sh 2 3 die() 4 { 5 printf "%s\n" "$@" | tee ./down 6 exit 1 7 } 8 9 SVNAME="$(basename $(pwd))" 10 HAS_LOG="$(test -d "$(pwd)/log" && printf "yes")" 11 exec 0<&- 12 set -x 13 14 test -f conf && . ./conf 15 if test "$SVNAME" = "log" 16 then 17 SVLOG="$(basename $(dirname $(pwd)))" 18 SVNAME="${SVLOG}/${SVNAME}" 19 AUTO_ROTATE=${AUTO_ROTATE:="no"} 20 fi 21 22 test "yes" = "${AUTO_ROTATE:=$HAS_LOG}" && 23 test "yes" = "$HAS_LOG" && 24 sv alarm "$(pwd)/log" 25 26 printf "Preparing %s launch...\n" $SVNAME 27 test "yes" = "$HAS_LOG" && exec 2>&1