File: myproxy.init

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 (91 lines) | stat: -rw-r--r-- 2,356 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# myproxy-server - Server for X.509 Public Key Infrastructure (PKI) security credentials
#
# chkconfig: - 55 25
# description:  Server for X.509 Public Key Infrastructure (PKI) security credentials
#
### BEGIN INIT INFO
# Provides: myproxy-server
# Required-Start:  $local_fs $network $syslog
# Required-Stop:  $local_fs $syslog
# Should-Start:  $syslog
# Should-Stop:  $network $syslog
# Default-Stop:
# Default-Start:
# Short-Description: Startup the MyProxy server daemon
# Description: Server for X.509 Public Key Infrastructure (PKI) security credentials
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

exec="/usr/sbin/myproxy-server"
prog=$(basename $exec)

# Defaults
MYPROXY_USER=myproxy
MYPROXY_OPTIONS="-s /var/lib/myproxy"
X509_USER_CERT=/etc/grid-security/myproxy/hostcert.pem
X509_USER_KEY=/etc/grid-security/myproxy/hostkey.pem

# Override defaults here.
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

# A few sanity checks 
[ ! -r $X509_USER_KEY ]  && echo -n "$prog: No hostkey file"  && failure && echo && exit 5
[ ! -r $X509_USER_CERT ] && echo -n "$prog: No hostcert file" && failure && echo && exit 5

lockfile=/var/lock/subsys/$prog


start() {
    status $prog > /dev/null && echo -n $"$prog already running: " && success  && echo && exit 0
    echo -n $"Starting $prog: "
    daemon --user $MYPROXY_USER X509_USER_CERT=$X509_USER_CERT X509_USER_KEY=$X509_USER_KEY $exec $MYPROXY_OPTIONS
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        status $prog
        ;;
    try-restart|condrestart)
        if status $prog >/dev/null ; then
            restart
        fi
	;;
    reload)
        # If config can be reloaded without restarting, implement it here,
        # remove the "exit", and add "reload" to the usage message below.
        # For example:
        status $prog >/dev/null || exit 7
        killproc $prog -HUP
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|reload|try-restart|force-reload}"
        exit 2
esac