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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: how to issue a shell command from EPICS record ? |
From: | Emmanuel Mayssat <[email protected]> |
To: | Christian Pauly <[email protected]>, EPICS Tech Talk <[email protected]> |
Date: | Tue, 1 Oct 2013 16:28:28 -0700 |
StreamDevice can do that.
You will have to write iocsh function, which you can call from StreamDevice. That iocsh function (programmed in C/C++) will call the system C-function with your script as an argument. Note that to use StreamDevice, you don't need a physical device (i.e. your protocol can just call your function) int dmc2183_escapeToShell(const char *p_command) { int status; status=system(p_command); switch(status) { case ERROR: printf("[ERROR] %s\n", p_command); break; case SUCCESS: funcLog(7, __FILE__ "[%d] SUCCESS\n", __LINE__); break; default: printf("[ERROR] status=%d\n", status); break; } return(SUCCESS); } static const iocshArg dmc2183_escapeToShellArg0 = {"Command", iocshArgString}; static const iocshArg* const dmc2183_escapeToShellArgs[1] = { &dmc2183_escapeToShellArg0}; static const iocshFuncDef dmc2183_escapeToShellFuncDef = { "dmc2183_escapeToShell",1,dmc2183_escapeToShellArgs}; static void dmc2183_escapeToShellCallFunc(const iocshArgBuf* args) { dmc2183_escapeToShell(args[0].sval); } static void DMC2183_iocshFuncRegistrar (void) { iocshRegister( &dmc2183_escapeToShellFuncDef, dmc2183_escapeToShellCallFunc); } epicsExportRegistrar(DMC2183_iocshFuncRegistrar); Enjoy, -- Emmanuel > Date: Tue, 1 Oct 2013 18:44:19 +0200 > From: [email protected] > To: [email protected] > Subject: how to issue a shell command from EPICS record ? > > Hi > Hope someone has a good advice for me: > > I implemented an XY-scanning table control using EPICS to handle an XY > step-motor table. > I use sscan records to implement automatic scans in x and xy-direction. > So far this works fine. > > Now i want to add one more thing: Before the scan starts, i have to > start the DAQ system with a certain BASH shell-script, after the scan i > have to stop the DAQ with another shell script. > > Can i somehow issue these shell-commands automatically before and after > the scan ? > Is there some record type available which can do this ??? > > I have been quite some time now, but could not find anything. > > Any advice ? > > best regards, > Christian |