[one-users] Patch to opennebula-3.8.1/share/scripts/one to allow checking the daemons' status
Jaime Melis
jmelis at opennebula.org
Wed Jan 9 05:59:36 PST 2013
Hi Simon,
thanks for the patch! I have created a feature request to follow this patch:
http://dev.opennebula.org/issues/1718
The only problem is that the patch was created on top of share/scripts/one
instead of the current location of the centos init scripts which are
located at share/pkgs/CentOS. Anyways it can be easily patched
I've assigned this feature to be released for OpenNebula 4.0
cheers,
Jaime
On Sat, Jan 5, 2013 at 1:47 PM, Simon J Mudd <sjmudd at pobox.com> wrote:
> Hi,
>
> I'm not sure the right forum to provide this so hope sending to the list
> is ok.
> One thing I found when initially trying to setup OpenNebula is that you
> can start and
> stop the daemons but you can not check if they are running. Most "init
> scripts" allow
> you to provide a status.
>
> This small patch provides that functionality. Perhaps it can be included?
>
> $ diff -u opennebula-3.8.1/share/scripts/one{.orig,}
> --- opennebula-3.8.1/share/scripts/one.orig 2013-01-05
> 13:38:50.846539319 +0100
> +++ opennebula-3.8.1/share/scripts/one 2013-01-05 13:39:08.110451396 +0100
> @@ -181,6 +181,38 @@
> }
>
>
> #------------------------------------------------------------------------------
> +# Function that checks if the daemons are running
>
> +#------------------------------------------------------------------------------
> +status()
> +{
> + if [ -f $ONE_PID ]; then
> + PID=$(cat $ONE_PID)
> + RESULT=$(/usr/bin/ps --no-heading -p $PID)
> +
> + if [ -z "$RESULT" ]; then
> + echo "DOWN: $ONED seems not to be running, $ONE_PID thinks it
> has pid $PID"
> + else
> + echo "UP: Found $ONED running with PID $PID"
> + fi
> + else
> + echo "DOWN: $ONE_PID does not exist."
> + fi
> +
> + if [ -f $ONE_SCHEDPID ]; then
> + PID=$(cat $ONE_SCHEDPID)
> + RESULT=$(/usr/bin/ps --no-heading -p $PID)
> +
> + if [ -z "$RESULT" ]; then
> + echo "DOWN: $ONE_SCHEDULER seems not to be running,
> $ONE_SCHEDPID thinks it has pid $PID"
> + else
> + echo "UP: Found $ONE_SCHEDULER running with PID $PID"
> + fi
> + else
> + echo "DOWN: $ONE_SCHEDPID does not exist."
> + fi
> +}
> +
>
> +#------------------------------------------------------------------------------
>
> #------------------------------------------------------------------------------
>
> if [ "$1" = "-f" ]; then
> @@ -197,8 +229,12 @@
> stop
> echo "oned and scheduler stopped"
> ;;
> + status)
> + # Check if everything is working.
> + status
> + ;;
> *)
> - echo "Usage: one [-f] {start|stop}" >&2
> + echo "Usage: one [-f] {start|stop|status}" >&2
> echo "Options:" >&2
> echo " -f Do not backup log file." >&2
> exit 3
> $
>
> On the server I'm trying to get OpenNebula working on I see this:
>
> [oneadmin at myhost ~]$ opennebula-3.8.1/share/scripts/one status
> UP: Found /usr/bin/oned running with PID 424
> UP: Found /usr/bin/mm_sched running with PID 425
> [oneadmin at myhost ~]$ one stop
> oned and scheduler stopped
> [oneadmin at myhost src]$ opennebula-3.8.1/share/scripts/one status
> DOWN: /var/run/one/oned.pid does not exist.
> DOWN: /var/run/one/sched.pid does not exist.
> [oneadmin at myhost ~]$ one start
> [oneadmin at myhost ~]$ opennebula-3.8.1/share/scripts/one status
> UP: Found /usr/bin/oned running with PID 30006
> UP: Found /usr/bin/mm_sched running with PID 30007
> [oneadmin at myhost ~]$
>
> I've not yet patched the active script but this shows how it works.
>
> Regards,
>
> Simon
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
--
Jaime Melis
Project Engineer
OpenNebula - The Open Source Toolkit for Cloud Computing
www.OpenNebula.org | jmelis at opennebula.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130109/76ebc641/attachment-0002.htm>
More information about the Users
mailing list