From 165b44c579fd74037164abf862b9eae136e9943c Mon Sep 17 00:00:00 2001 From: Pete Jemian <prjemian@gmail.com> Date: Fri, 26 Apr 2013 23:08:58 +0000 Subject: [PATCH] add shell script to avoid starting a 2nd instance of this IOC --- iocBoot/iocLinux/run | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/iocBoot/iocLinux/run b/iocBoot/iocLinux/run index 001877b..88c9172 100755 --- a/iocBoot/iocLinux/run +++ b/iocBoot/iocLinux/run @@ -1 +1,15 @@ +#!/bin/sh + +# ensure that multiple, simultaneous IOCs are not started by this user ID + +MY_UID=`id -u` +IOC_PID="`/usr/bin/pgrep xxx -u ${MY_UID}`" + +if [ "" != "${IOC_PID}" ] ; then + echo "xxx IOC is already running, won't start a new one, PID=${IOC_PID}" + exit 1 +fi + +# start the IOC + ../../bin/${EPICS_HOST_ARCH}/xxx st.cmd -- GitLab