File: etc.init.d.myproxy

package info (click to toggle)
myproxy 6.1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,628 kB
  • ctags: 1,812
  • sloc: ansic: 25,183; sh: 11,726; perl: 3,673; makefile: 361
file content (128 lines) | stat: -rwxr-xr-x 3,323 bytes parent folder | download | duplicates (6)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
#
# SysV-style boot script for MyProxy
#
# chkconfig: 345 99 06
# description: MyProxy online credential repository

# Set GLOBUS_LOCATION as appropriate for your installation.
GLOBUS_LOCATION=""
export GLOBUS_LOCATION

if [ -z $GLOBUS_LOCATION ]; then
    echo "GLOBUS_LOCATION is not set."
    echo "Please edit $0 to set GLOBUS_LOCATION."
    exit 1
fi

if [ -e ${GLOBUS_LOCATION}/share/globus/globus-script-initializer ]; then
    . ${GLOBUS_LOCATION}/share/globus/globus-script-initializer
elif [ -e ${GLOBUS_LOCATION}/libexec/globus-script-initializer ]; then
    . ${GLOBUS_LOCATION}/libexec/globus-script-initializer
else
    echo "globus-script-initializer not found in"
    echo "${GLOBUS_LOCATION}/share/globus or"
    echo "${GLOBUS_LOCATION}/libexec."
    exit 1
fi
. ${libexecdir}/globus-sh-tools.sh

MYPROXY=${GLOBUS_LOCATION}/sbin/myproxy-server
PID_FILE=${localstatedir}/myproxy.pid

# Optional server configuration arguments follow.
# Uncomment and modify to change default settings.
#LISTEN="-l myserver.mydomain.com"
#PORT="-p 7512"
#CONFIG="-c ${GLOBUS_LOCATION}/etc/myproxy-server.config"
#STORE="-s ${GLOBUS_LOCATION}/var/lib/myproxy"
#VERBOSE="-verbose"

# By default, the myproxy-server uses /etc/grid-security/hostcert.pem
# and /etc/grid-security/hostkey.pem.  Uncomment and modify the
# following lines to configure the myproxy-server to find its
# certificate and key in alternate locations.
#X509_USER_CERT="/usr/local/etc/myproxycert.pem"
#X509_USER_KEY="/usr/local/etc/myproxykey.pem"
#export X509_USER_CERT X509_USER_KEY

do_start()
{
    if [ ! -x $MYPROXY ]; then
        echo "$MYPROXY is not executable.  Skipping MyProxy startup."
        exit 1
    fi
    if [ ! -d $localstatedir ]; then
        mkdir -p $localstatedir
    fi
    echo -n "Starting up MyProxy server... "
    $MYPROXY $LISTEN $PORT $CONFIG $STORE $VERBOSE -P $PID_FILE
    if [ $? -eq 0 ]; then
        echo "done."
    else
        echo "Failed to start MyProxy server!"
        exit 1
    fi
}

do_stop()
{
    echo -n "Stopping the MyProxy server... "
    pid=`cat $PID_FILE`
    kill -TERM $pid
    rm -f $PID_FILE
    echo "done."
}

do_reconfig()
{
    echo -n "Reconfiguring the MyProxy server... "
    pid=`cat $PID_FILE`
    kill -HUP $pid
    echo "done."
}

case "$1" in
    start)
        if [ ! -f $PID_FILE ]; then
            do_start
        else
            pid=`cat $PID_FILE`
            psout=`ps -A | grep $pid | grep -v grep | awk "{if (\\\$1 == $pid) print}"`
            if [ "x$psout" = "x" ]; then
                echo "Found stale myproxy-server pid file... removing it."
                rm -f $PID_FILE
                do_start
            else
                echo "MyProxy server is already running!"
            fi
        fi
        ;;

    stop)
        if [ -f $PID_FILE ] ; then
            do_stop
        else
            echo "The server's pid file does not exist!  Are you sure the server is running?"
        fi
        ;;

    reconfig)
        if [ -f $PID_FILE ] ; then
            do_reconfig
        else
            echo "The server's pid file does not exist!  Are you sure the server is running?"
        fi
        ;;

    restart)
        $0 stop
        $0 start
        ;;

    *)
        echo "Usage: $0 (start|stop|restart)"
        exit 1
esac

exit 0