This repository has been archived by the owner on Mar 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
/
keyless.init
executable file
·115 lines (104 loc) · 2.13 KB
/
keyless.init
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
#!/bin/bash
# keyless init file
#
# processname: keyless
# pidfile: /var/run/keyless.pid
# source function library
. /etc/rc.d/init.d/functions
keyless_OPTIONS=""
[ -e /etc/sysconfig/keyless ] && . /etc/sysconfig/keyless
RETVAL=0
prog="keyless"
binary=/usr/bin/kssl_server
pidfile=/var/run/keyless.pid
lockfile=/var/lock/subsys/$prog
start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
if [ ! -f /var/run/keyless.pid ]
then
touch /var/run/keyless.pid
fi
/bin/chown $USER:$GROUP /var/run/keyless.pid
$binary --port=$PORT \
--server-cert=$SERVER_CERT \
--server-key=$SERVER_KEY \
--private-key-directory=$PRIVATE_KEY_DIR \
--cipher-list=$CIPHER_LIST \
--ca-file=$CA_FILE \
--num-workers=$NUM_WORKERS \
--daemon \
--syslog \
--user $USER:$GROUP \
--pid-file=$pidfile
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc -p $pidfile $binary
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile
fi;
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e $lockfile ] && restart
return 0
}
rh_status_q(){
status $prog >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
start
RETVAL=$?
;;
stop)
rh_status_q || exit 0
stop
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
reload)
rh_status_q || exit 7
exit 3
;;
force-reload)
restart
RETVAL=$?
;;
condrestart|try-restart)
rh_status_q || exit 0
condrestart
RETVAL=$?
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|force-reload}"
RETVAL=2
esac
exit $RETVAL