Another way you can restart STAFProc is by using the STAF PROCESS service
to submit a command that shuts down STAF and waits for the shutdown to
complete and then restarts STAFProc. For example, to restart STAFProc on
a remote or local machine, run the following PROCESS START request,
replacing machine with the remote machine's hostname or IP address if you
want to restart STAFProc on a remote machine, or replace machine with
local if you want to restart STAFProc on the local machine, You can check
the {STAF/Config/StartupTime} variable on this machine before and after
you submit the PROCESS START command to restart STAFProc to verify that
the date/time shows that STAFProc was just restarted. For example:
C:\>STAF machine VAR RESOLVE STRING {STAF/Config/StartupTime}
Response
--------
20130701-16:46:34
C:\>STAF machine PROCESS START SHELL COMMAND "STAF local SHUTDOWN SHUTDOWN
{STAF/Config/Sep/Command} sleep 1m {STAF/Config/Sep/Command} STAFProc"
WORKDIR {STAF/Config/STAFRoot} SAMECONSOLE STDOUT
{STAF/DataDir}/STAFRestart.out STDERRTOSTDOUT WAIT
Error submitting request, RC: 22
Additional info
---------------
STAFConnectionReadUInt: Error reading from socket: other side closed
socket: 22
Note that this PROCESS START command should fail with RC 22 when STAFProc
is shut down on the target machine. Wait for another 30 seconds or so to
give enough time to complete shutting down and restarting STAFProc on the
target machine before checking the new STAFProc startup time.
C:\>STAF machine VAR RESOLVE STRING {STAF/Config/StartupTime}
Response
--------
20130701-16:48:01
Notes:
1) If machine is Windows {STAF/Config/Sep/Command} is "&" or if it is
Unix, {STAF/Config/Sep/Command} is a semi-colon ";". You can specify a
different name for the stdout file name if desired. It is a good idea to
redirect the commands' stdout/stderr output to a file (by specifying the
STDOUT and STDERRTOSTDOUT options) so that you can check it to see what
went wrong if STAFProc is not restarted properly. Note that if you
specify "{STAF/DataDir}/STAFRestart.out" for the STDOUT value, the
{STAF/DataDir} STAF variable resolves to the data/<STAFInstanceName>
directory in the STAF root directory on the target machine (e.g. generally
C:\STAF\data\STAF on Windows or /usr/local/staf/data/STAF on Unix). So,
that's the directory where the STAFRestart.out file would be written to.
2) After submitting this PROCESS START request, you'll need to wait an
additional 30 seconds or so (depending on how many services are registered
in the STAF.cfg file, etc) for STAFProc to restart and then you can check
the {STAF/Config/StartupTime} variable on this machine to verify that the
date/time shows that STAFProc was just restarted.
3) A more sophisticated approach would be for the command to not just
sleep for 1 minute (which may be longer than it takes for STAF to actually
shut down or possibly not long enough depending on the number of services
registered, processes running that need to be notified, etc). Instead,
you could write a script that in a loop, waits for STAFProc to shutdown by
perhaps sleeping for 5 or 10 seconds and then submitting a STAF machine
PING PING request and waiting for it to fail with RC 16. Then you could
run this script in place of "sleep 1m" in the command.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
----- Forwarded by Sharon Lucas/Austin/IBM on 07/01/2013 03:51 PM -----
From: Sharon Lucas/Austin/IBM@IBMUS
To: 陈加萍 <chenjiap...@dce.com.cn>,
Cc: staf-users@lists.sourceforge.net
Date: 06/28/2013 07:28 AM
Subject: Re: [staf-users] [ask question] how to restart the STAF?
There isn't a restart command for STAFProc. Note that many of the
configuration settings in the STAF.cfg file can also be made dynamically
via STAF service requests so that you might not have to restart STAFProc.
However, not that these dynamic setting changes will not be retained after
STAF is shutdown so you'll also want to also change the STAF.cfg file if
you want to make these changes permanent (e.g. so that they'll be in
effect as well the next time that STAFProc is restarted).
You can shutdown STAF and then start up STAF as you mentioned to restart
STAFProc. For example:
STAF local SHUTDOWN SHUTDOWN
cd C:\STAF OR if Unix: cd /usr/local/staf
startSTAFProc.bat OR if Unix: ./startSTAFProc.sh
Or, if you have STAFProc configured to restart automatically upon system
reboot, you could reboot the system (e.g. via a STAF PROCESS START
request). Section "11. Starting STAFProc during system reboot" in the
STAF Installation Guide at
http://staf.sourceforge.net/current/STAFInstall.pdf has more information
on this. However, I understand that you may not want to reboot the system
in order to simply restart STAFProc.
There is an open feature request, Feature #677 "Provide restart request",
at https://sourceforge.net/p/staf/feature-requests/677/. You can add a
comment to this feature stating that you would also like to see this
implemented to increase its priority.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: 陈加萍 <chenjiap...@dce.com.cn>
To: Sharon Lucas/Austin/IBM@IBMUS,
Cc: <staf-users@lists.sourceforge.net>
Date: 06/28/2013 03:55 AM
Subject: [ask question] how to restart the STAF?
Hi,
I’m sorry to bother you again. I am writing to ask a question.
According to the user guide(see setion 5.1 STAFProc): “Any changes made
to the STAF Configuration File after STAFProc has been started will not
take effect until you shutdown and restart STAFProc”
As we know, "STAF local shutdown shutdown" is used to stop the STAFProc
daemon process. If I want to restart the STAF which command should I can
use ?(except “stafproc” ,which is used to start STAF)
Best wishes !
----------------------------------------------------
Chen jiaping
Tel:13478918276
Email:chenjiap...@dec.com.cn
----------------------------------------------------
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users