EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: IOCs under procServ as system services under systemd?
From: Niklas Claesson <[email protected]>
To: Ralph Lange <[email protected]>
Cc: EPICS Tech-Talk <[email protected]>
Date: Tue, 21 Jun 2016 10:17:19 +0200 (CEST)
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

-- 

-- 
───────────────────────┐ ┌─┐ ┌─┐ ┌─┐ ┌───────────────────────
                       └─┘ └─┘ └─┘ └─┘ 
Niklas Claesson , HW & SW Developer             Cosylab Sweden
M.S., Electrical Engineering http://www.cosylab.com Email: [email protected] Phone: +46 (707) 201901
Google: [email protected] Skype: nickez 
──┐ ┌─┐ ┌─┐ ┌─┐ ┌───────────────────────────┐ ┌─┐ ┌─┐ ┌─┐ ┌──
  └─┘ └─┘ └─┘ └─┘                           └─┘ └─┘ └─┘ └─┘ 



Replies:
Re: IOCs under procServ as system services under systemd? S. Banerian
References:
IOCs under procServ as system services under systemd? Ralph Lange

Navigate by Date:
Prev: IOCs under procServ as system services under systemd? Ralph Lange
Next: Archiver Appliance stuck in "Initail 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  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: IOCs under procServ as system services under systemd? Ralph Lange
Next: Re: IOCs under procServ as system services under systemd? S. Banerian
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·