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  2016  2017  2018  2019  2020  2021  <20222023  2024  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  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Start IOC automatically at boot
From: "Hu, Yong via Tech-talk" <tech-talk at aps.anl.gov>
To: Donny Domagoj Cosic <Donny.Domagoj.Cosic at irb.hr>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 6 Jan 2022 23:14:43 +0000

Hi Donny,

 

As long as you use “sudo manage-iocs start myIOC” to start your IOC and “sudo manage-iocs stop myIOC” to stop your IOC, the Python process "python your-python-file.py" should be automatically terminated when the IOC is stopped.

 

Try this before and after you type “sudo manage-iocs stop myIOC”: ps -ef | grep your-python-file.py

You will see the process come and then go away.

 

Cheers,

Yong

 

From: Donny Domagoj Cosic <Donny.Domagoj.Cosic at irb.hr>
Date: Thursday, January 6, 2022 at 5:40 PM
To: Hu, Yong <yhu at bnl.gov>
Cc: GAGET Alexis <alexis.gaget at cea.fr>, tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: Re: Start IOC automatically at boot

Hi,

I added - system "python your-python-file.py &" to my st.cmd file and
when the ioc starts, the python scripts start! Thank you for the
suggestion.

However when I stop the ioc, the python scripts remain running in the
background. How can I get the python scripts to stop when the ioc is
stopped?

Regards,
---
Donny Domagoj Cosic

Laboratory for Ion Beam Interactions
Ruđer Bošković Institute
Bijenička cesta 54 | HR-10 000 Zagreb | CROATIA
T: +385 1 4561 041 | @: dcosic at irb.hr | https://urldefense.com/v3/__http://www.irb.hr__;!!P4SdNyxKAPE!WeEYOl_03uqMBGrFKBjASsDC4I7VlxQzQpy_fCSLKoUG-QZEsW1-JZjNVmnB$

Dana 06.01.2022 18:35, Hu, Yong je napisao(la):
> Another way automatically start the python script with the ioc, simply
> add this kind of line at the end of your IOC’s st.cmd:
>
> system "python your-python-file.py &"
>
> However, you need include “system.dbd” in your IOC application. In
> your application’s src/Makefile, add this kind of line:
>
> yourIOCApplicationName_DBD += system.dbd
>
> FROM: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of GAGET
> Alexis via Tech-talk <tech-talk at aps.anl.gov>
>  DATE: Thursday, January 6, 2022 at 12:11 PM
>  TO: Donny Domagoj Cosic <Donny.Domagoj.Cosic at irb.hr>,
> tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
>  SUBJECT: RE: Start IOC automatically at boot
>
> Hi,
>
> "Is there a way to automatically start the python script with the
> ioc?"
>
> -> You can simply use procServ as well to execute your python script
>
> -------------------------
>
> DE : Tech-talk <tech-talk-bounces at aps.anl.gov> de la part de Donny
> Domagoj Cosic via Tech-talk <tech-talk at aps.anl.gov>
>  ENVOYÉ : mercredi 5 janvier 2022 21:30:07
>  À : Ralph Lange via Tech-talk
>  OBJET : Start IOC automatically at boot
>
> Happy new year!
>
>  I am trying to install systemd-softioc (procServ) as outlines here
https://github.com/NSLS-II/systemd-softioc [1]. I followed the
> instructions
>  and successfully installed it on my Raspberry Pi. I installed the IOC
>
>  and can manually start the softioc, however I am not able to start
> the
>  IOC using manage-iocs. I get the following output:
>
>  softioc@raspberrypi:/epics/iocs/testIOC2$ sudo manage-iocs start
>  testIOC2
>  Starting the IOC 'testIOC2' ...
>  Failed to start the IOC 'testIOC2'; type 'sudo journalctl -xe' for
>  details.
>
>  Below is my config file and output from the journalctl
>
>  Config
>  ---------
>  NAME=testIOC2
>  PORT=4053
>  HOST=raspberrypi
>  USER=softioc
>  CHDIR="/epics/iocs/testIOC2/iocBoot/ioctestIOC2"
>  EXEC="$CHDIR/st.cmd"
>
>  Output from journalctl
>  -------------------------
>  Jan 05 21:11:29 raspberrypi sudo[13371]: softioc : TTY=pts/0 ;
>  PWD=/epics/iocs/testIOC2 ; USER=root ; COMMAND=/usr/bin/manage-iocs
>  install testIOC2
>  Jan 05 21:11:29 raspberrypi sudo[13371]: pam_unix(sudo:session):
> session
>  opened for user root by (uid=0)
>  Jan 05 21:11:29 raspberrypi sudo[13371]: pam_unix(sudo:session):
> session
>  closed for user root
>  Jan 05 21:11:43 raspberrypi sudo[13423]: softioc : TTY=pts/0 ;
>  PWD=/epics/iocs/testIOC2 ; USER=root ; COMMAND=/usr/bin/manage-iocs
>  start testIOC2
>  Jan 05 21:11:43 raspberrypi sudo[13423]: pam_unix(sudo:session):
> session
>  opened for user root by (uid=0)
>  Jan 05 21:11:43 raspberrypi systemd[1]: Reloading.
>  Jan 05 21:11:43 raspberrypi systemd[1]: [email protected]:
>  Current command vanished from the unit file, execution of the command
>
>  list won't be resume
>  Jan 05 21:11:43 raspberrypi systemd[1]: plexmediaserver.service:
> Current
>  command vanished from the unit file, execution of the command list
> won't
>  be resumed.
>  Jan 05 21:11:44 raspberrypi systemd[1]: Condition check resulted in
> IOC
>  testIOC2 via procServ being skipped.
>  -- Subject: A start job for unit softioc-testIOC2.service has
> finished
>  successfully
>  -- Defined-By: systemd
>  -- Support: https://urldefense.com/v3/__https://www.debian.org/support__;!!P4SdNyxKAPE!WeEYOl_03uqMBGrFKBjASsDC4I7VlxQzQpy_fCSLKoUG-QZEsW1-JWSxDXye$  [2]
>  --
>  -- A start job for unit softioc-testIOC2.service has finished
>  successfully.
>  --
>  -- The job identifier is 1803.
>  Jan 05 21:11:45 raspberrypi sudo[13423]: pam_unix(sudo:session):
> session
>  closed for user root
>  Jan 05 21:11:54 raspberrypi sudo[13487]: softioc : TTY=pts/0 ;
>  PWD=/epics/iocs/testIOC2 ; USER=root ; COMMAND=/usr/bin/journalctl
> -xe
>  Jan 05 21:11:54 raspberrypi sudo[13487]: pam_unix(sudo:session):
> session
>  opened for user root by (uid=0)
>
>  The softioc testIOC2 contains a few records which get updated from a
>  python script. Which brings me to my next questions. Is there a way
> to
>  automatically start the python script with the ioc?
>
>  Thank you very much for your help,
>
>  Regards
>  --
>  Donny Domagoj Cosic
>
>  Laboratory for Ion Beam Interactions
>  Ruđer Bošković Institute
>  Bijenička cesta 54 | HR-10 000 Zagreb | CROATIA
>  T: +385 1 4561 041 | @: dcosic at irb.hr | https://urldefense.com/v3/__http://www.irb.hr__;!!P4SdNyxKAPE!WeEYOl_03uqMBGrFKBjASsDC4I7VlxQzQpy_fCSLKoUG-QZEsW1-JZjNVmnB$  [3]
>
> Links:
> ------
> [1] https://github.com/NSLS-II/systemd-softioc
> [2]
> https://urldefense.com/v3/__https:/www.debian.org/support__;!!P4SdNyxKAPE!XScIVOM_CZDyHbp9c76gj4WzN_hFVrfqEqfAzjKK-hfgXnNgknPHzlsNS57f$
> [3]
> https://urldefense.com/v3/__http:/www.irb.hr__;!!P4SdNyxKAPE!XScIVOM_CZDyHbp9c76gj4WzN_hFVrfqEqfAzjKK-hfgXnNgknPHznuurVW7$


Replies:
Re: Start IOC automatically at boot Ralph Lange via Tech-talk
Re: Start IOC automatically at boot Donny Domagoj Cosic via Tech-talk
References:
Start IOC automatically at boot Donny Domagoj Cosic via Tech-talk
RE: Start IOC automatically at boot GAGET Alexis via Tech-talk
Re: Start IOC automatically at boot Hu, Yong via Tech-talk
Re: Start IOC automatically at boot Donny Domagoj Cosic via Tech-talk

Navigate by Date:
Prev: Re: Start IOC automatically at boot Donny Domagoj Cosic via Tech-talk
Next: Re: Start IOC automatically at boot Ralph Lange via Tech-talk
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  <20222023  2024 
Navigate by Thread:
Prev: Re: Start IOC automatically at boot Donny Domagoj Cosic via Tech-talk
Next: Re: Start IOC automatically at boot Ralph Lange via Tech-talk
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  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·