Subject: |
Re: IOCs under procServ as system services under systemd? |
From: |
"S. Banerian" <[email protected]> |
To: |
EPICS Tech-Talk <[email protected]> |
Date: |
Tue, 21 Jun 2016 13:33:06 -0700 |
I have been trying to get a systemd service to work, and almost had
something working, but observed systemd errors: status failed but ioc
running, systemctl stop failing to stop the service.
Based on what Nick has below, I changed (added) just one flag to my
ExecStart line with procServ, i.e. ' -f ' and I now have a functioning
single-ioc service.
our bare-bones service file has this:
[Unit]
Description=start IOC via procserv
Requires=network.target
After=network.target auditd.service
ConditionFileIsExecutable=/usr/bin/procServ
ConditionFileIsExecutable=/usr/local/ops/iocBoot/ioccontrol/st.cmd
ConditionDirectoryNotEmpty=/usr/local/ops
RequiresMountsFor=/usr/local/epics /usr/local/ops
[Service]
EnvironmentFile=-/usr/local/ops/etc/epics.env
ExecStart=/usr/bin/procServ -f -L /usr/local/ops/var/procioc.log -p
/run/ioc.pid -l $PROCSERV_REMOTE_PORT $PROCSERV_LOCAL_PORT
/usr/local/ops/iocBoot/ioccontrol/st.cmd
ExecStop=/bin/kill -9 ` cat /run/ioc.pid`
KillMode=process
Restart=on-failure
User=ioc
[Install]
WantedBy=multi-user.target
where the EnvironmentFile contains many common variables and also the
$PROCSERV* variables.
Thanks to Nick for that ' -f ' flag
stefani
On 06/21/2016 01:17 AM, Niklas Claesson wrote:
> I do, but it is a bit special since I automatically create services based on the contents of a directory.
>
> I have a service template that looks like this (will create one service per IOC):
>
> ```
> [Unit]
> Description=IOC: %I
> After=rc-local.service
>
> [Service]
> User=ioc
>
> # Only execute IOC if st.cmd exists
> AssertPathExists=/opt/startup/ioc/%H/%i/st.cmd
>
> # Execute StartPre with root permissions
> PermissionsStartOnly=true
> ExecStartPre=/bin/mkdir -p /var/log/procServ
> ExecStartPre=/bin/chown -R ioc:ioc /var/log/procServ
> ExecStartPre=/bin/mkdir -p /var/run/procServ/%i
> ExecStartPre=/bin/chown -R ioc:ioc /var/run/procServ/%i
> EnvironmentFile=/opt/startup/ioc/%H/%i/env.sh
>
> # Run procServ with user ioc
> ExecStart=/usr/bin/procServ --allow -f -L /var/log/procServ/out-%i -i ^C^D -c /var/run/procServ/%i ${PROCSERV_PORT} ${EPICS_MODULES_PATH}/environment/${ENVIRONMENT_VERSION}/${BASE}/bin/${EPICS_HOST_ARCH}/iocsh /opt/startup/ioc/%H/%i/st.cmd -n %i
>
> [Install]
> WantedBy=multi-user.target
> ```
>
> and then I have a "master" service which creates all the IOC services:
>
> ```
> [Unit]
> Description=IOC Starter
> After=ess-boot.service
>
> [Service]
> Type=oneshot
> ExecStart=/bin/sh -c 'for i in /opt/startup/ioc/%H/*; do /bin/systemctl start ioc@$${i##*/}.service; done'
> ```
>
> Sources are here: https://bitbucket.org/europeanspallationsource/m-epics-environment/src/4e7777bf062f5cf8f895a8e79775c0360600149e/meta/systemd/system/?at=master
>
>
> Cheers,
> Niklas
>
> ----- Original Message -----
>
>> All,
>
>> As more and more people are facing a move of Linux based IOC hosts
>> towards systemd...
>
>> Does anyone has a working setup for systemd, that manages an IOC under
>> procServ as a system service?
>> I would really like to have a standard setup (in the procServ contrib
>> dir and on the EPICS Wiki) to allow sharing what people develop on top
>> of it.
>
>> Any help is appreciated!
>
>> Thanks,
>> ~Ralph
>
--
Stefani Banerian
UW Clinical Cyclotron
UW School of Medicine
UW Box 356043
206-598-0302
gpg key 6642E7EE
fingerprint = BD13 875D 2D03 5E1D 1E3B 8BF7 F4B8 63AD 6642 E7EE
- References:
- IOCs under procServ as system services under systemd? Ralph Lange
- Re: IOCs under procServ as system services under systemd? Niklas Claesson
- Navigate by Date:
- Prev:
Re: Archiver Appliance stuck in "Initail sampling" state Shankar, Murali
- Next:
RE: Archiver Appliance stuck in "Initial sampling" state rory.clarke
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: IOCs under procServ as system services under systemd? Niklas Claesson
- Next:
Re: IOCs under procServ as system services under systemd? Konrad, Martin
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
|