Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Cloud:OTC:Tools
uvp-monitor
initscript-comment.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File initscript-comment.diff of Package uvp-monitor
Index: uvp-monitor/monitor/uvp-monitor =================================================================== --- uvp-monitor.orig/monitor/uvp-monitor +++ uvp-monitor/monitor/uvp-monitor @@ -6,14 +6,18 @@ # description: uvp monitor # ### BEGIN INIT INFO -# Provides: uvp-monitor -# Required-Start: -# Should-Start: $network $remote_fs +# Provides: uvp-monitor +# Required-Start: +# Should-Start: $network $remote_fs # Required-Stop: -# Should-Stop: $network $remote_fs -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Description: uvp-monitor does feed monitoring data to the host +# Should-Stop: $network $remote_fs +# Default-Start: 2 3 5 +# Default-Stop: 0 1 6 +# Short-Description: uvp-monitor does feed monitoring data to the host +# Description: uvp-monitor does enable various additional features +# of the UVP xen hypervisor in the OTC cloud, such as collecting monitoring +# data, graceful shutdown, snapshots (for backups), better live-migration +# connection survival, time sync with host, cpu/mem hotplug. ### END INIT INFO PATH=$PATH:/opt/otc/uvp-monitor:/bin:/sbin:/usr/sbin:/usr/bin @@ -24,11 +28,12 @@ Info='eval 2>&1 logger "[uvp-monitor:$FU ############################################################################### SYSTEM=unknown PIDFILE=$(basename "$BINARY") +if test -r /etc/os-release; then source /etc/os-release; fi if [ -f /etc/redhat-release -o -n "$(grep -i 'GreatTurbo' /etc/issue)" ] then SYSTEM=redhat PIDFILE="/var/lock/subsys/$PIDFILE" -elif [ -f /etc/SuSE-release ] +elif [ -f /etc/SuSE-release ] || [[ "$ID" == *suse* ]] || [[ "$ID" == *sles* ]] then SYSTEM=suse PIDFILE="/var/run/$PIDFILE" @@ -44,6 +49,12 @@ else fi fi +CURROS=`/opt/otc/uvp-monitor/detect-currentos` +ETCCURR=`cat /etc/uvp-monitor/CurrentOS 2>/dev/null` +if test "$CURROS" != "ETCCURR"; then + echo $CURROS > /etc/uvp-monitor/CurrentOS +fi + ############################################################################### if [ "$SYSTEM" = "redhat" ] then @@ -111,16 +122,29 @@ check_running() PIDOF=':' fi - if [ -f "${PIDFILE}" -o -n "$($PIDOF $BINARY)" ] - then - return 0 + if [ -f "${PIDFILE}" ]; then + if $PIDOF $BINARY >/dev/null; then + return 0 + else + return 1 + fi else - return 1 + return 3 fi } StartService() { + if type -p systemd-virt-detect >/dev/null 2>&1; then + VIRT=$(systemd-virt-detect) + else + read VIRT </sys/hypervisor/type 2>/dev/null + fi + if test "$VIRT" != "xen" -a ! -d /proc/xen; then + # avoid indicating failure + echo "Not starting uvp-monitor on flavors not based on XEN" + exit 0 + fi $Info "Starting uvp-monitor service " if ! check_running then @@ -131,6 +155,15 @@ StartService() msg_failed return 1 fi + # Only required/avail on some kernels, does not hurt to try always try ... + HYPE=$(cat /sys/hypervisor/type 2>/dev/null) + if test ! -e /dev/xen/xenbus && test ! -e /proc/xen/xenbus && test "$HYPE" == "xen"; then + modprobe xen_procfs >/dev/null 2>&1 || modprobe xenfs >/dev/null 2>&1 + if test ! -e /dev/xen/xenbus && test ! -e /proc/xen/xenbus; then + mount -t xenfs XENFS_UVP /proc/xen + fi + fi + modprobe xen_hcall >/dev/null 2>&1 daemon $BINARY > /dev/null RETVAL=$? @@ -154,7 +187,8 @@ StartService() StopService() { $Info "Stopping uvp-monitor service " - if check_running + check_running + if [ $? != 3 ] then # wait for uvptools upgrading trap 'echo 1>&2 ; exit 0' INT TERM QUIT HUP @@ -169,6 +203,7 @@ StopService() killproc "$BINARY" ; rm -f "${PIDFILE}" rm -f "$PIDFILE" + umount XENFS_UVP >/dev/null 2>&1 if ! check_running then msg_success @@ -191,7 +226,7 @@ RestartService() StopService ret=$? i=0 - while [ "$i" -lt 5 ] + while [ "$i" -lt 3 ] do i=$((i+1)) if check_running @@ -221,14 +256,17 @@ RestartService() ServiceStatus() { - echo -n "Checking for uvp-monitor" - if check_running - then + echo -n "Checking for uvp-monitor:" + check_running + rv=$? + if [ $rv = 0 ]; then echo " running..." + elif [ $rv = 1 ]; then + echo " dead ..." else echo " not running... " fi - return 0 + return $rv } ############################################################################### @@ -238,7 +276,7 @@ start) StartService retv=$? i=0 - while [ "$i" -lt 5 ] + while [ "$i" -lt 3 ] do i=$((i+1)) if ! check_running
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor