import repository from arizona
[raven.git] / apps / failsafe / failsafe.sh
1 #! /bin/bash
2
3 cd /usr/local/stork/failsafe
4
5 if [ -f /var/run/storkfailsafe.pid ]; then
6     echo "failsafe is already running"
7     exit
8 fi
9
10 echo $$ > /var/run/storkfailsafe.pid
11
12 STORK_REPO_URL="https://stork-repository.cs.arizona.edu"
13 BLACKLIST_BASE_URL=$STORK_REPO_URL/blacklist
14
15 STORK_VERSION=`rpm -q stork-client`
16 if [ $? -ne 0 ]; then
17     echo "Stork-client RPM is not installed. Aborting."
18     rm -f /var/run/storkfailsafe.pid
19     exit
20 fi
21
22 echo "Stork-client version $STORK_VERSION is installed."
23
24 if [ -d /etc/planetlab ]; then
25     echo "Platform is planetlab"
26     PLATFORM="planetlab"
27 else
28     echo "Unknown platform. Aborting."
29     rm -f /var/run/storkfailsafe.pid
30     exit
31 fi
32
33 BLACKLIST_URL=$BLACKLIST_BASE_URL/$STORK_VERSION
34
35 wget -O - $BLACKLIST_URL > /dev/null
36
37 if [ $? -ne 0 ]; then
38     echo "Blacklist file does not exist. Nothing to do."
39     rm -f /var/run/storkfailsafe.pid
40     exit
41 fi
42
43 # current initscript fails if anything that depends on PyXML is installed
44 rpm -e sfa-client
45 rpm -e sfa
46 rpm -e python-ZSI
47
48 ./initscript
49
50 rm -f /var/run/storkfailsafe.pid