batch script for managing django fastcgi daemons

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
WEB_DIR="/web"
DJANGO_DIRS="ozon adlist.it-omsk.com dumpz.org pydev.ru web-brains.com pybb.org netdb.ru"
bulk_action() {
action=$1
for DIR in $DJANGO_DIRS; do
spawn_file="$WEB_DIR/$DIR/web_site/spawn.sh"
echo $spawn_file $action
if [ ! -f "$spawn_file" ]; then
echo "file $spawn_file does not exist"
else
$spawn_file $action
fi
done
}
usage() {
echo "Usage: $0 [start|stop|restart]"
exit 1
}
case $1 in
"start") bulk_action "start";;
"stop") bulk_action "stop";;
"restart") bulk_action "restart";;
*) usage;;
esac