-
Notifications
You must be signed in to change notification settings - Fork 1
/
checklabelservers.sh
executable file
·81 lines (69 loc) · 1.8 KB
/
checklabelservers.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
PATH=$PATH:/opt/ts/gnu/bin/
LOCK=/home/dschwen/wma/.checklabelserv.lock.`hostname`
if [ 1000 -lt $(($(date +%s) - $(stat -c '%Y' "$LOCK"))) ]
then
echo stale lockfile found, deleting
rm $LOCK
fi
if [ ! -s $LOCK ]
then
echo $$ > $LOCK
#
# find and kill old php processes
#
for pid in `ps -u dschwen -o"pid comm" | awk '{ if( $2 == "/opt/php/bin/php-cgi" ) print $1 }'`
do
if [ /proc/$pid/auxv -ot .lastrun ]
then
kill $pid
fi
done
touch .lastrun
#
# Check if tile generators are running
#
for zoom in 8 9 10 11 12
do
TGFIL="/tmp/wikiminiatlas.tile${zoom}.pid"
TGEXE='none'
if [ -e $TGFIL ]
then
TGPID=`cat /tmp/wikiminiatlas.tile${zoom}.pid`
TGEXE=`pargs ${TGPID} | head -n1 | cut -f2 | cut -d' ' -f1`
fi
if [ "$TGEXE" = "/home/dschwen/wma/programs/mapniktile/mapniktile4" ]
then
date > /tmp/wikiminiatlas.lastchecked
else
date
echo starting tileserver for zoom $zoom
pushd /var/www/wikiminiatlas/tiles
nohup /home/dschwen/wma/wikiminiatlas_servers/programs/mapniktile/mapniktile4 $zoom > /home/dschwen/wma/log/mapnik.log.$zoom.`hostname` &
popd
fi
done
#
# new satellite data fetcher/scaler
#
# TGFIL="/tmp/wikiminiatlas.sat.pid"
# TGEXE='none'
# if [ -e $TGFIL ]
# then
# TGPID=`cat /tmp/wikiminiatlas.sat.pid`
# TGEXE=`pargs ${TGPID} | head -n1 | cut -f2 | cut -d' ' -f1`
# fi
# if [ "$TGEXE" = "/home/dschwen/wma/programs/satscaler/satscale" ]
# then
# date > /tmp/wikiminiatlas.lastchecked
# else
# date
# echo starting satellite rescaling tileserver
# pushd /home/dschwen/public_html/wma/tiles
# nohup /home/dschwen/wma/programs/satscaler/satscale > /home/dschwen/wma/log/mapnik.sat.log.`hostname` &
# popd
# fi
: > $LOCK
else
echo lockfile found.
fi