<div dir="ltr">Hi Simon,<div><br></div><div>thanks for the patch! I have created a feature request to follow this patch:</div><div><a href="http://dev.opennebula.org/issues/1718">http://dev.opennebula.org/issues/1718</a><br>

</div><div><br></div><div style>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</div>

<div style><br></div><div style>I've assigned this feature to be released for OpenNebula 4.0</div><div style><br></div><div style>cheers,<br>Jaime</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sat, Jan 5, 2013 at 1:47 PM, Simon J Mudd <span dir="ltr"><<a href="mailto:sjmudd@pobox.com" target="_blank">sjmudd@pobox.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm not sure the right forum to provide this so hope sending to the list is ok.<br>
One thing I found when initially trying to setup OpenNebula is that you can start and<br>
stop the daemons but you can not check if they are running. Most "init scripts" allow<br>
you to provide a status.<br>
<br>
This small patch provides that functionality. Perhaps it can be included?<br>
<br>
$ diff -u opennebula-3.8.1/share/scripts/one{.orig,}<br>
--- opennebula-3.8.1/share/scripts/one.orig     2013-01-05 13:38:50.846539319 +0100<br>
+++ opennebula-3.8.1/share/scripts/one  2013-01-05 13:39:08.110451396 +0100<br>
@@ -181,6 +181,38 @@<br>
 }<br>
<br>
 #------------------------------------------------------------------------------<br>
+# Function that checks if the daemons are running<br>
+#------------------------------------------------------------------------------<br>
+status()<br>
+{<br>
+    if [ -f $ONE_PID ]; then<br>
+        PID=$(cat $ONE_PID)<br>
+        RESULT=$(/usr/bin/ps --no-heading -p $PID)<br>
+<br>
+        if [ -z "$RESULT" ]; then<br>
+            echo "DOWN: $ONED seems not to be running, $ONE_PID thinks it has pid $PID"<br>
+        else<br>
+            echo "UP: Found $ONED running with PID $PID"<br>
+        fi<br>
+    else<br>
+        echo "DOWN: $ONE_PID does not exist."<br>
+    fi<br>
+<br>
+    if [ -f $ONE_SCHEDPID ]; then<br>
+        PID=$(cat $ONE_SCHEDPID)<br>
+        RESULT=$(/usr/bin/ps --no-heading -p $PID)<br>
+<br>
+        if [ -z "$RESULT" ]; then<br>
+            echo "DOWN: $ONE_SCHEDULER seems not to be running, $ONE_SCHEDPID thinks it has pid $PID"<br>
+        else<br>
+            echo "UP: Found $ONE_SCHEDULER running with PID $PID"<br>
+        fi<br>
+    else<br>
+        echo "DOWN: $ONE_SCHEDPID does not exist."<br>
+    fi<br>
+}<br>
+<br>
+#------------------------------------------------------------------------------<br>
 #------------------------------------------------------------------------------<br>
<br>
 if [ "$1" = "-f" ]; then<br>
@@ -197,8 +229,12 @@<br>
         stop<br>
         echo "oned and scheduler stopped"<br>
         ;;<br>
+    status)<br>
+        # Check if everything is working.<br>
+        status<br>
+        ;;<br>
     *)<br>
-        echo "Usage: one [-f] {start|stop}" >&2<br>
+        echo "Usage: one [-f] {start|stop|status}" >&2<br>
         echo "Options:" >&2<br>
         echo "  -f  Do not backup log file." >&2<br>
         exit 3<br>
$<br>
<br>
On the server I'm trying to get OpenNebula working on I see this:<br>
<br>
[oneadmin@myhost ~]$ opennebula-3.8.1/share/scripts/one status<br>
UP: Found /usr/bin/oned running with PID 424<br>
UP: Found /usr/bin/mm_sched running with PID 425<br>
[oneadmin@myhost ~]$ one stop<br>
oned and scheduler stopped<br>
[oneadmin@myhost src]$ opennebula-3.8.1/share/scripts/one status<br>
DOWN: /var/run/one/oned.pid does not exist.<br>
DOWN: /var/run/one/sched.pid does not exist.<br>
[oneadmin@myhost ~]$ one start<br>
[oneadmin@myhost ~]$ opennebula-3.8.1/share/scripts/one status<br>
UP: Found /usr/bin/oned running with PID 30006<br>
UP: Found /usr/bin/mm_sched running with PID 30007<br>
[oneadmin@myhost ~]$<br>
<br>
I've not yet patched the active script but this shows how it works.<br>
<br>
Regards,<br>
<br>
Simon<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
</blockquote></div><br></div><br clear="all"><div><br></div>-- <br>Jaime Melis<br>Project Engineer<br>OpenNebula - The Open Source Toolkit for Cloud Computing<br><a href="http://www.OpenNebula.org" target="_blank">www.OpenNebula.org</a> | <a href="mailto:jmelis@opennebula.org" target="_blank">jmelis@opennebula.org</a>