|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
|
|
|
# |
|
|
|
|
# Filename: package/.../runit/stone_mod_runit.sh |
|
|
|
|
# Copyright (C) 2008 The OpenSDE Project |
|
|
|
|
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|
|
|
|
# |
|
|
|
|
# More information can be found in the files COPYING and README. |
|
|
|
@ -15,8 +16,18 @@
|
|
|
|
|
# [MAIN] 30 runit Service Manager (runit) |
|
|
|
|
|
|
|
|
|
SYSCONFDIR=/etc |
|
|
|
|
SERVICEDIR=/service |
|
|
|
|
COMMANDDIR=/command |
|
|
|
|
|
|
|
|
|
if [ -d /service ]; then |
|
|
|
|
SERVICEDIR=/service |
|
|
|
|
else |
|
|
|
|
SERVICEDIR=/var/service |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ -x /command/sv ]; then |
|
|
|
|
SV=/command/sv |
|
|
|
|
else |
|
|
|
|
SV=sv |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
declare -a runit_installed |
|
|
|
|
declare -a runit_available |
|
|
|
@ -63,10 +74,10 @@ runit_svc() {
|
|
|
|
|
[ "$actions" ] && actions="$actions '' ''" |
|
|
|
|
|
|
|
|
|
actions="$actions 'service: $dir' '' \ |
|
|
|
|
' stats: $( $COMMANDDIR/sv status $dir/ 2> /dev/null | sed -e 's,;.*,,' -e 's,:.*:,,' -e 's,(.*) ,,' )' ''" |
|
|
|
|
actions="$actions 'sv up $name (up)' '$COMMANDDIR/sv up $dir; sleep 1'" |
|
|
|
|
actions="$actions 'sv down $name(down)' '$COMMANDDIR/sv down $dir; sleep 1'" |
|
|
|
|
actions="$actions 'sv hup $name (HUP)' '$COMMANDDIR/sv hup $dir; sleep 1'" |
|
|
|
|
' stats: $( $SV status $dir/ 2> /dev/null | sed -e 's,;.*,,' -e 's,:.*:,,' -e 's,(.*) ,,' )' ''" |
|
|
|
|
actions="$actions 'sv up $name (up)' '$SV up $dir; sleep 1'" |
|
|
|
|
actions="$actions 'sv down $name(down)' '$SV down $dir; sleep 1'" |
|
|
|
|
actions="$actions 'sv hup $name (HUP)' '$SV hup $dir; sleep 1'" |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
eval "gui_menu runit_sc_menu '$service -> $location' $actions" |
|
|
|
@ -100,7 +111,7 @@ main() {
|
|
|
|
|
action="runit_svc $SERVICEDIR/${runit_installed[$entry*3+0]} ${runit_installed[$entry*3+1]}" |
|
|
|
|
stats[0]=; stats[1]=; i=0 |
|
|
|
|
while read stats[i++]; do :; done < <( \ |
|
|
|
|
$COMMANDDIR/sv status \ |
|
|
|
|
$SV status \ |
|
|
|
|
"${runit_installed[$entry*3+1]}" 2> /dev/null | \ |
|
|
|
|
sed -e 's,; ,\n,' | sed -e 's,:.*:,,' -e 's,(.*) ,,' ) |
|
|
|
|
[ "${stats[0]}" ] && text="$text [${stats[0]}]" || text="$text [ERROR]" |
|
|
|
|