1 |
#!/bin/sh |
2 |
|
3 |
### BEGIN INIT INFO |
4 |
# Provides: openstack-swift-proxy |
5 |
# Required-Start: $remote_fs |
6 |
# Required-Stop: $remote_fs |
7 |
# Default-Start: 3 5 |
8 |
# Default-Stop: 0 1 6 |
9 |
# Short-Description: Swift proxy server |
10 |
# Description: Account server for swift. |
11 |
### END INIT INFO |
12 |
|
13 |
# openstack-swift-proxy: swift proxy server |
14 |
# |
15 |
# chkconfig: - 20 80 |
16 |
# description: Proxy server for swift. |
17 |
|
18 |
. /etc/rc.status |
19 |
. /usr/share/openstack-swift/functions |
20 |
|
21 |
name="proxy" |
22 |
|
23 |
[ -e "/etc/sysconfig/openstack-swift-$name" ] && . "/etc/sysconfig/openstack-swift-$name" |
24 |
|
25 |
lockfile="/var/lock/subsys/openstack-swift-proxy" |
26 |
|
27 |
start() { |
28 |
swift_action "$name" start |
29 |
retval=$? |
30 |
[ $retval -eq 0 ] && touch $lockfile |
31 |
return $retval |
32 |
} |
33 |
|
34 |
stop() { |
35 |
swift_action "$name" stop |
36 |
retval=$? |
37 |
[ $retval -eq 0 ] && rm -f $lockfile |
38 |
return $retval |
39 |
} |
40 |
|
41 |
restart() { |
42 |
stop |
43 |
start |
44 |
} |
45 |
|
46 |
rh_status() { |
47 |
swift_action "$name" status |
48 |
} |
49 |
|
50 |
rh_status_q() { |
51 |
rh_status &> /dev/null |
52 |
} |
53 |
|
54 |
mkvarrun() { |
55 |
test -d /var/run/swift || mkdir /var/run/swift |
56 |
test -d /var/run/swift/${name}-server || mkdir /var/run/swift/${name}-server |
57 |
} |
58 |
|
59 |
mkvarrun |
60 |
|
61 |
|
62 |
case "$1" in |
63 |
start) |
64 |
rh_status_q && exit 0 |
65 |
$1 |
66 |
;; |
67 |
stop) |
68 |
rh_status_q || exit 0 |
69 |
$1 |
70 |
;; |
71 |
restart) |
72 |
$1 |
73 |
;; |
74 |
reload) |
75 |
;; |
76 |
status) |
77 |
rh_status |
78 |
;; |
79 |
condrestart|try-restart) |
80 |
rh_status_q || exit 0 |
81 |
restart |
82 |
;; |
83 |
*) |
84 |
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}" |
85 |
exit 2 |
86 |
esac |
87 |
exit $? |