Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / etc / init / | server ip : 172.67.156.115 your ip : 172.70.130.174 H O M E |
Filename | /etc/init/wait-for-state.conf |
Size | 1.49 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:50 |
Last modified | 12-Apr-2014 05:54 |
Last accessed | 06-Jul-2025 13:48 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
author "Clint Byrum <[email protected]>"
description "Waiting for state"
task
normal exit 2
stop on started $WAIT_FOR or stopped $WAIT_FOR
# These are all arguments for use influencing how this job waits
env TIMEOUT=30
env MANUAL_OVERRIDE="N"
env WAIT_FOREVER="N"
env WAIT_STATE="started"
env TARGET_GOAL="start"
# Required args w/ no sensible default, the tests at the beginning of
# the script are just to guard against WAITER="" or WAIT_FOR="", as the
# instance line will fail if they are not set, since they have no env
instance $WAITER$WAIT_FOR
script
test -n "$WAIT_FOR" || exit 1
test -n "$WAITER" || exit 1
# We don't want to override the manual stanza
# XXX: initctl show-config should share manual w/ us too
case $MANUAL_OVERRIDE in
N|n|0)
if grep -q "^\s*manual\s*$" /etc/init/$WAIT_FOR.conf /etc/init/$WAIT_FOR.override 2>/dev/null; then
exit 0
fi
;;
esac
if [ "$WAIT_STATE" = "stopped" ] ; then
TARGET_GOAL="stop"
fi
# Already running/stopped?
status $WAIT_FOR | grep -q "$TARGET_GOAL/$WAIT_STATE" && exit 0
# Give it a push
$TARGET_GOAL $WAIT_FOR || :
# upstart will kill this shell on started/stopped $WAIT_FOR
while sleep $TIMEOUT ; do
case $WAIT_FOREVER in
N|n|0)
exit 100
;;
Y|y|1)
;;
*)
exit 1
;;
esac
done
# Very strange, sleep returned non-zero?
exit 1
end script
description "Waiting for state"
task
normal exit 2
stop on started $WAIT_FOR or stopped $WAIT_FOR
# These are all arguments for use influencing how this job waits
env TIMEOUT=30
env MANUAL_OVERRIDE="N"
env WAIT_FOREVER="N"
env WAIT_STATE="started"
env TARGET_GOAL="start"
# Required args w/ no sensible default, the tests at the beginning of
# the script are just to guard against WAITER="" or WAIT_FOR="", as the
# instance line will fail if they are not set, since they have no env
instance $WAITER$WAIT_FOR
script
test -n "$WAIT_FOR" || exit 1
test -n "$WAITER" || exit 1
# We don't want to override the manual stanza
# XXX: initctl show-config should share manual w/ us too
case $MANUAL_OVERRIDE in
N|n|0)
if grep -q "^\s*manual\s*$" /etc/init/$WAIT_FOR.conf /etc/init/$WAIT_FOR.override 2>/dev/null; then
exit 0
fi
;;
esac
if [ "$WAIT_STATE" = "stopped" ] ; then
TARGET_GOAL="stop"
fi
# Already running/stopped?
status $WAIT_FOR | grep -q "$TARGET_GOAL/$WAIT_STATE" && exit 0
# Give it a push
$TARGET_GOAL $WAIT_FOR || :
# upstart will kill this shell on started/stopped $WAIT_FOR
while sleep $TIMEOUT ; do
case $WAIT_FOREVER in
N|n|0)
exit 100
;;
Y|y|1)
;;
*)
exit 1
;;
esac
done
# Very strange, sleep returned non-zero?
exit 1
end script