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" -- 2.11.0 ------------------------------------------------------------------------------ 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