Modified init scripts for inclusion in Fedora
[ovirt-node/TEMP.git] / scripts / ovirt
blob9503c0677bf9402d8e4921b2d9fecf5cb6da9098
1 #!/bin/bash
3 # ovirt Start ovirt services
5 # chkconfig: - 11 99
6 # description: ovirt services
9 # Source functions library
10 . /etc/init.d/functions
11 . /etc/init.d/ovirt-functions
13 prog=ovirt
14 lockfile=/var/lock/subsys/$prog
16 start() {
18 touch $lockfile
20 if is_standalone; then
21 return 0
23 find_srv ipa tcp
24 if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
25 krb5_conf=/etc/krb5.conf
26 # FIXME this is IPA specific
27 wget -q --no-check-certificate \
28 http://$SRV_HOST:$SRV_PORT/ipa/config/krb5.ini -O $krb5_conf.tmp
29 if [ $? -ne 0 ]; then
30 log "Failed to get $krb5_conf"; return 1
32 mv $krb5_conf.tmp $krb5_conf
33 else
34 log "skipping Kerberos configuration"
37 find_srv identify tcp
38 if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
39 krb5_tab=/etc/libvirt/krb5.tab
40 # skip ktab download if we got it from /config
41 if [ -s $krb5_tab ]; then
42 krb5_tab=
44 ovirt-awake start $SRV_HOST $SRV_PORT $krb5_tab
45 if [ $? -ne 0 ]; then
46 log "ovirt-awake failed"; return 1
48 else
49 log "skipping ovirt-awake, oVirt identify service not available"
52 find_srv collectd udp
53 if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
54 collectd_conf=/etc/collectd.conf
55 if [ -f $collectd_conf.in ]; then
56 sed -e "s/@COLLECTD_SERVER@/$SRV_HOST/" \
57 -e "s/@COLLECTD_PORT@/$SRV_PORT/" \
58 -e "/<Plugin rrdtool>/,/<\/Plugin>/d" $collectd_conf.in \
59 > $collectd_conf
60 if [ $? -ne 0 ]; then
61 log "Failed to write $collectd_conf"; return 1
64 else
65 log "skipping collectd configuration, collectd service not available"
68 find_srv qpidd tcp
69 if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
70 libvirt_qpid_conf=/etc/sysconfig/libvirt-qpid
71 if [ -f $libvirt_qpid_conf ]; then
72 echo "LIBVIRT_QPID_ARGS=\"--broker $SRV_HOST --port $SRV_PORT\"" >> $libvirt_qpid_conf
73 echo "/usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname`" >> $libvirt_qpid_conf
75 matahari_conf=/etc/sysconfig/matahari
76 if [ -f $matahari_conf ]; then
77 echo "MATAHARI_ARGS=\"--broker $SRV_HOST --port $SRV_PORT\"" >> $matahari_conf
78 echo "/usr/kerberos/bin/kinit -k -t /etc/libvirt/krb5.tab qpidd/`hostname`" >> $matahari_conf
80 else
81 log "skipping libvirt-qpid and matahari configuration, could not find $libvirt_qpid_conf"
84 rm -f $lockfile
87 case "$1" in
88 start)
89 printf "Starting ovirt: "
92 log "Starting ovirt"
93 start
94 log "Completed ovirt"
95 } >> $OVIRT_LOGFILE 2>&1
97 test $? == 0 && success || failure
98 echo
100 status)
101 status $prog
103 reload)
104 stop
105 start
107 stop)
108 stop
111 echo "Usage: ovirt {start}"
112 exit 2
113 esac