EPICS Home

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  <20202021  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  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: How to run IOC in docker containers properly
From: Heinz Junkes via Tech-talk <tech-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Thu, 18 Jun 2020 12:10:43 +0200
For my convenience (to be able to access my VMEbus CPUs remotely) I built this into the rtems_init:


*
 ***********************************************************************
 *                         TELNET DAEMON                               *
 ***********************************************************************
 */
#define LINE_SIZE 256
static void
telnet_pseudoIocsh(char *name, void *arg)
{
  char line[LINE_SIZE];
  int fid[3], save_fid[3];

  printf("info:  pty dev name = %s\n", name);

  save_fid[1] = dup2(1,1);
  fid[1] = dup2( fileno(stdout), 1);
  if (fid[1] == -1 ) printf("Can't dup stdout\n");
  save_fid[2] = dup2(2,2);
  fid[2] = dup2( fileno(stderr), 2);
  if (fid[2] == -1 ) printf("Can't dup stderr\n");

  const char *prompt = "tIocSh> ";

  while (1) {
    fputs(prompt, stdout);
    fflush(stdout);
    /* telnet close not detected ??? tbd */
    if (fgets(line, LINE_SIZE, stdin) == NULL) {
      dup2(save_fid[1],1);
+     dup2(save_fid[2],2);
      return;
    }
    if (line[strlen(line)-1] == '\n') line[strlen(line)-1] = 0;
    if (!strncmp( line, "bye",3)) {
      printf( "%s", "Will end session\n");
      dup2(save_fid[1],1);
      dup2(save_fid[2],2);
      return;
     }
     iocshCmd(line);
   }
}


and defined this in the telned_config_table.


Viele Grüße
Heinz Junkes
--
Experience directly varies with equipment ruined.



> On 18. Jun 2020, at 05:06, Michael Davidsaver via Tech-talk <tech-talk at aps.anl.gov> wrote:
> 
> On 6/17/20 4:26 PM, Johnson, Andrew N. via Tech-talk wrote:
>>> While we're at it I would like to propose a forth solution: How about
>>> beefing up the IOC itself so it can listen on a socket for connections
>>> to the IOC shell? This would come with a few advantages (some of them
>>> might only apply to systems running systemd):
>>> 
>>> ...
>>> 
>>> Thoughts? Maybe a project for the upcoming online codeathon?
>> 
>> I think that would be best implemented in an external module. You don’t have to use the iocsh to run your IOCs – you can write your own shell, or set up the stdin/stdout/stderr streams to point to something else before running iocsh() in the main() routine. You might want to disable readline if you do that though unless you are completely emulating a tty.
> 
> Something like this would be functionally similar to the RTEMS telnetd
> created by Till Straumann.  I quite liked that feature.
> 
> I think having the option of a more daemon-like IOC, while preserving
> the feature set of IOC shell, would be an excellent project.  While
> it would probably be best to try this idea as an external module (if
> possible).  I see no reason why this sort of enhancement couldn't be
> included in Base.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


References:
How to run IOC in docker containers properly xiao zhang via Tech-talk
Re: How to run IOC in docker containers properly Johnson, Andrew N. via Tech-talk
Re: How to run IOC in docker containers properly Ben Franksen via Tech-talk
Re: How to run IOC in docker containers properly J. Lewis Muir via Tech-talk
Re: How to run IOC in docker containers properly Johnson, Andrew N. via Tech-talk
Re: How to run IOC in docker containers properly Konrad, Martin via Tech-talk
Re: How to run IOC in docker containers properly Johnson, Andrew N. via Tech-talk
Re: How to run IOC in docker containers properly Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: Re: How to run IOC in docker containers properly Michael Davidsaver via Tech-talk
Next: Re: How to run IOC in docker containers properly 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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: How to run IOC in docker containers properly Michael Davidsaver via Tech-talk
Next: Re: How to run IOC in docker containers properly 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  <20202021  2022  2023  2024