From c4a90021bdaf6478dc46961eedb95e5834d129f9 Mon Sep 17 00:00:00 2001 From: "Pete R. Jemian" Date: Sat, 18 Jul 2020 17:31:52 -0500 Subject: [PATCH 1/2] ENH #377 --- apstools/beamtime/apsbss_ioc.sh | 9 ++++++++- docs/source/applications/apsbss_ioc.rst | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apstools/beamtime/apsbss_ioc.sh b/apstools/beamtime/apsbss_ioc.sh index c577deef6..6a5c0dad3 100755 --- a/apstools/beamtime/apsbss_ioc.sh +++ b/apstools/beamtime/apsbss_ioc.sh @@ -78,6 +78,12 @@ function checkpid() { return ${IOC_DOWN} } +function checkup () { + if ! checkpid; then + restart + fi +} + function console () { if checkpid; then echo "Connecting to ${SCREEN_SESSION}'s screen session" @@ -158,7 +164,7 @@ function stop() { } function usage() { - echo "Usage: $(basename "${SHELL_SCRIPT_NAME}") {start|stop|restart|status|console|run} [NAME [PREFIX]]" + echo "Usage: $(basename "${SHELL_SCRIPT_NAME}") {start|stop|restart|status|checkup|console|run} [NAME [PREFIX]]" echo "" echo " COMMANDS" echo " console attach to IOC console if IOC is running in screen" @@ -180,6 +186,7 @@ case ${SELECTION} in stop | kill) stop ;; restart) restart ;; status) status ;; + checkup) checkup ;; console) console ;; run) run_ioc ;; *) usage ;; diff --git a/docs/source/applications/apsbss_ioc.rst b/docs/source/applications/apsbss_ioc.rst index 35e25c668..ba96268ff 100644 --- a/docs/source/applications/apsbss_ioc.rst +++ b/docs/source/applications/apsbss_ioc.rst @@ -168,7 +168,9 @@ from EPICS base, use the supplied IOC management shell script first before trying to start the IOC. -Here's an example starter script for the IOC from APS 9-ID-C (USAXS): +Here's an example starter script for the IOC from APS 9-ID-C (USAXS). +This shell script is stored as file `~/bin/ioc9idcbss.sh` with +executable permissions: .. code-block:: bash @@ -188,3 +190,12 @@ Here's an example starter script for the IOC from APS 9-ID-C (USAXS): cd "${APSTOOLS}"/beamtime ./apsbss_ioc.sh "${@}" "${PROCESS_NAME}" "${IOC_PREFIX}" + + + +Here's an example cron task for the IOC from APS 9-ID-C (USAXS) +to keep the softIoc running (and start the IOC after system reboot): + +.. code-block:: text + + */2 * * * * /home/beams/USAXS/bin/ioc9idcbss.sh checkup 2>&1 > /dev/null From 26b87b399116d5ee71dcf9fefea2549e5f711c60 Mon Sep 17 00:00:00 2001 From: "Pete R. Jemian" Date: Sat, 18 Jul 2020 17:35:41 -0500 Subject: [PATCH 2/2] DOC #377 --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index bf09b12f9..ea35e01f4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,8 @@ Change History :1.3.1: release expected 2020-07-19 + * `#378 `_ + apsbss_ioc.sh: add checkup (keep-alive feature for the IOC) * `#376 `_ apsbss: example beam line-specific shell scripts * `#375