[Unit]
Description=IOC: emu-lebt
After=rc-local.service
 
[Install]
WantedBy=multi-user.target
 
[Service]
User=root

# Only execute IOC if st.cmd exists
AssertPathExists=/opt/startup/ioc/VME_EMU-iamspecial/emu/st.cmd
 
# Execute StartPre with root permissions
ExecStartPre=/bin/mkdir -p /var/log/procServ
ExecStartPre=/bin/chown -R ioc:ioc /var/log/procServ
ExecStartPre=/bin/mkdir -p /var/run/procServ/emu
ExecStartPre=/bin/chown -R ioc:ioc /var/run/procServ/emu
EnvironmentFile=/opt/startup/ioc/VME_EMU-iamspecial/emu/env.sh
 
# Run procServ with user ioc
ExecStart=/usr/bin/procServ --allow -f -L /var/log/procServ/out-emu -i ^C^D -c /var/run/procServ/emu ${PROCSERV_PORT} ${EPICS_MODULES_PATH}/environment/${ENVIRONMENT_VERSION}/${BASE}/bin/${EPICS_HOST_ARCH}/iocsh /opt/startup/ioc/VME_EMU-iamspecial/emu/st.cmd -n emu