Hi Rafael, not sure if checking status of OpenSAF before ordering a reboot will have any effect as the result
of the call will only be momentarily accurate. Is the problem this ticket address when SMF is ordering a reboot of a not fully started OpenSAF, and the "opensafd start/stop already in progress" message in the syslog? If so, is this a problem, as a reboot has been ordered and will be performed but without running opensafd stop? Perhaps we can change severity of the opensafd log messages instead? /Thanks HansN On 05/15/2017 03:56 PM, Rafael Odzakow wrote: > Internally opensafd creates a lock file during start/stop to avoid > parallel execution. To allow others to query the state this ticket will > use the opensafd lockfile to report the status of start/stop when > requested with "opensafd status" > --- > src/nid/opensafd.in | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in > index e7683bd7e..54841c372 100644 > --- a/src/nid/opensafd.in > +++ b/src/nid/opensafd.in > @@ -12,6 +12,17 @@ > # Description: Start and stop the OpenSAF node > ### END INIT INFO > > +# Exit codes: > +# 0: OK > +# 1: General error > +# 2: Argument error > +# > +# 'status' exit codes: > +# 0: OK > +# 1: AMF state error > +# 3: No AMF PID found > +# 4: Lockfile is taken, opensafd start/stop is in progress > + > osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf > osafprog="opensafd" > osafprog_inprogress="opensafd_inprogress" > @@ -326,9 +337,15 @@ forcereload() { > } > > status() { > + > amfpid=`pidofproc -p $amfnd_pid $amfnd_bin` > - if [ -n "$amfpid" ]; then > + > + if [ -e "$lockfile_inprogress" ]; then > + echo "Lockfile taken, OpenSAF start/stop is in progress" > + RETVAL=4 > + elif [ -n "$amfpid" ]; then > amf-state siass ha > + # Two possible error codes: 0 or 1 > RETVAL=$? > else > echo "The OpenSAF HA Framework is not running" ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel