gcc484ntopperl-5.22
Last change
on this file since c5c522c was
c5c522c,
checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago
|
initial commit, transferred from cleaned syn3 svn tree
|
-
Property mode set to
100755
|
File size:
742 bytes
|
Rev | Line | |
---|
[c5c522c] | 1 | #!/bin/bash |
---|
| 2 | # Stop a service and wait until it's really down |
---|
| 3 | SERVICE=$1 |
---|
| 4 | TIMEOUT=$2 |
---|
| 5 | |
---|
| 6 | if ! [ -e "$SERVICE/run" ]; then |
---|
| 7 | exit 0 |
---|
| 8 | fi |
---|
| 9 | |
---|
| 10 | if [ "$TIMEOUT" == "" ]; then |
---|
| 11 | TIMEOUT=90 |
---|
| 12 | fi |
---|
| 13 | |
---|
| 14 | svc -d $SERVICE |
---|
| 15 | sleep .1 |
---|
| 16 | while ! svstat $SERVICE | grep ': down' >/dev/null; do |
---|
| 17 | svc -d $SERVICE |
---|
| 18 | if [ "$TIMEOUT" == "0" ]; then |
---|
| 19 | exit 1 |
---|
| 20 | fi |
---|
| 21 | ((TIMEOUT--)) |
---|
| 22 | #with 30 seconds left, we send an interupt. |
---|
| 23 | #This is a forcefull shutdown without waiting for clients for most services |
---|
| 24 | if [ "$TIMEOUT" == 30 ]; then |
---|
| 25 | echo -n "sending interrupt " |
---|
| 26 | svc -i $SERVICE |
---|
| 27 | fi |
---|
| 28 | #with 10 seconds lefts, we just kill it |
---|
| 29 | if [ "$TIMEOUT" == 10 ]; then |
---|
| 30 | echo -n "KILLING " |
---|
| 31 | svc -k $SERVICE |
---|
| 32 | fi |
---|
| 33 | sleep 1 |
---|
| 34 | echo -n "." |
---|
| 35 | done |
---|
| 36 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.