|
1 |
#!/bin/sh |
|
|
2 |
# |
3 |
# Univention libvirt |
4 |
# init script for libvirtd |
5 |
# |
6 |
# Copyright 2010 Univention GmbH |
7 |
# |
8 |
# http://www.univention.de/ |
9 |
# |
10 |
# All rights reserved. |
11 |
# |
12 |
# The source code of this program is made available |
13 |
# under the terms of the GNU Affero General Public License version 3 |
14 |
# (GNU AGPL V3) as published by the Free Software Foundation. |
15 |
# |
16 |
# Binary versions of this program provided by Univention to you as |
17 |
# well as other copyrighted, protected or trademarked materials like |
18 |
# Logos, graphics, fonts, specific documentations and configurations, |
19 |
# cryptographic keys etc. are subject to a license agreement between |
20 |
# you and Univention and not subject to the GNU AGPL V3. |
21 |
# |
22 |
# In the case you use this program under the terms of the GNU AGPL V3, |
23 |
# the program is provided in the hope that it will be useful, |
24 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
25 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
26 |
# GNU Affero General Public License for more details. |
27 |
# |
28 |
# You should have received a copy of the GNU Affero General Public |
29 |
# License with the Debian GNU/Linux or Univention distribution in file |
30 |
# /usr/share/common-licenses/AGPL-3; if not, see |
31 |
# <http://www.gnu.org/licenses/>. |
32 |
|
33 |
if [ ! -e /etc/runit/univention/univention-libvirt ] |
34 |
then |
35 |
exit 0 |
36 |
fi |
37 |
|
38 |
. /lib/lsb/init-functions |
39 |
|
40 |
case "$1" in |
41 |
start) |
42 |
# check ucr autostart setting |
43 |
if [ -f "/usr/share/univention-config-registry/init-autostart.lib" ] |
44 |
then |
45 |
. "/usr/share/univention-config-registry/init-autostart.lib" |
46 |
check_autostart univention-libvirt libvirt/autostart |
47 |
fi |
48 |
log_action_msg "Starting univention-libvirt daemon:" |
49 |
sv up univention-libvirt |
50 |
log_action_end_msg 0 |
51 |
;; |
52 |
stop) |
53 |
log_action_msg "Stopping univention-libvirt daemon: " |
54 |
sv down univention-libvirt |
55 |
log_action_end_msg 0 |
56 |
;; |
57 |
restart|force-reload) |
58 |
# check ucr autostart setting |
59 |
if [ -f "/usr/share/univention-config-registry/init-autostart.lib" ] |
60 |
then |
61 |
. "/usr/share/univention-config-registry/init-autostart.lib" |
62 |
check_autostart univention-libvirt libvirt/autostart |
63 |
fi |
64 |
log_action_msg "Restarting univention-libvirt daemon: " |
65 |
sv restart univention-libvirt |
66 |
log_action_end_msg 0 |
67 |
;; |
68 |
crestart) |
69 |
# check ucr autostart setting |
70 |
if [ -f "/usr/share/univention-config-registry/init-autostart.lib" ] |
71 |
then |
72 |
. "/usr/share/univention-config-registry/init-autostart.lib" |
73 |
check_autostart univention-libvirt libvirt/autostart |
74 |
fi |
75 |
if sv status univention-libvirt | grep -q -s ^run: |
76 |
then |
77 |
"$0" restart |
78 |
else |
79 |
log_action_msg "sv status return no running libvirt, don't need to restart." |
80 |
fi |
81 |
;; |
82 |
*) |
83 |
log_action_msg "Usage: $0 {start|stop|restart|crestart|force-reload}" |
84 |
exit 1 |
85 |
;; |
86 |
esac |