Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apsbss_ioc.sh: add checkup (enables a keep-alive feature for the IOC) #378

Merged
merged 2 commits into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Change History

:1.3.1: release expected 2020-07-19

* `#378 <https://github.com/BCDA-APS/apstools/pull/378>`_
apsbss_ioc.sh: add checkup (keep-alive feature for the IOC)
* `#376 <https://github.com/BCDA-APS/apstools/pull/376>`_
apsbss: example beam line-specific shell scripts
* `#375 <https://github.com/BCDA-APS/apstools/pull/375`_
Expand Down
9 changes: 8 additions & 1 deletion apstools/beamtime/apsbss_ioc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -180,6 +186,7 @@ case ${SELECTION} in
stop | kill) stop ;;
restart) restart ;;
status) status ;;
checkup) checkup ;;
console) console ;;
run) run_ioc ;;
*) usage ;;
Expand Down
13 changes: 12 additions & 1 deletion docs/source/applications/apsbss_ioc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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