mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
libvirt-guests: enhance status
LSB and https://fedoraproject.org/wiki/Packaging/SysVInitScript require status to output something useful, rather than just use the exit code. * daemon/libvirt-guests.init.in (rh_status): Break into new routine, and provide output. (usage): Document status.
This commit is contained in:
parent
592277bcff
commit
c629a2883c
@ -282,10 +282,28 @@ gueststatus() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# rh_status
|
||||||
|
# Display current status: whether saved state exists, and whether start
|
||||||
|
# has been executed. We cannot use status() from the functions library,
|
||||||
|
# since there is no external daemon process matching this init script.
|
||||||
|
rh_status() {
|
||||||
|
if [ -f "$LISTFILE" ]; then
|
||||||
|
echo $"stopped, with saved guests"
|
||||||
|
RETVAL=3
|
||||||
|
else
|
||||||
|
if [ -f "$VAR_SUBSYS_LIBVIRT_GUESTS" ]; then
|
||||||
|
echo $"started"
|
||||||
|
else
|
||||||
|
echo $"stopped, with no saved guests"
|
||||||
|
fi
|
||||||
|
RETVAL=0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# usage [val]
|
# usage [val]
|
||||||
# Display usage string, then exit with VAL (defaults to 2).
|
# Display usage string, then exit with VAL (defaults to 2).
|
||||||
usage() {
|
usage() {
|
||||||
echo $"Usage: $0 {start|stop|restart|force-reload|gueststatus|shutdown}"
|
echo $"Usage: $0 {start|stop|status|restart|force-reload|gueststatus|shutdown}"
|
||||||
exit ${1-2}
|
exit ${1-2}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,11 +324,7 @@ case "$1" in
|
|||||||
force-reload)
|
force-reload)
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
if [ -f "$LISTFILE" ]; then
|
rh_status
|
||||||
RETVAL=3
|
|
||||||
else
|
|
||||||
RETVAL=0
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
shutdown)
|
shutdown)
|
||||||
ON_SHUTDOWN=shutdown
|
ON_SHUTDOWN=shutdown
|
||||||
|
Loading…
x
Reference in New Issue
Block a user