along these lines: #!/bin/sh while IFS= read -r string; do echo -n "32790 EVT22: Start PLC now!" >> "/tmp/fuse/control/logevt/alarm" done exit 0
may not be 100% correct, taken from: https://unix.stackexchange.com/questions/433066/bash-succinct-way-to-loop-over-lines-from-stdin-or-command-line-arguments -- verify with this info. It also looks like it is ok to ignore the message itself in your case. HTH Rainer El vie, 17 jun 2022 a las 9:45, d.jagodic (<d.jago...@aon.at>) escribió: > > Thanks for the reply, but I'm not sure I understood what I needed to do. > > How to keep the script active? The script only needs to write text once > per event. > > What should I do after writing the text to the file? > > Regards > > Drasko > > Am 17.06.2022 um 09:11 schrieb Rainer Gerhards: > > your script (rsysevent32790.sh) does not work properly. It needs to > > keep active and not terminate by itself. Instead, once started, it > > needs top read stdin until EOF is reached. > > > > Rsyslog warns about the unexpected abnormal termination. That was > > probably introduced in some version. > > > > HTH > > Rainer > > > > El vie, 17 jun 2022 a las 1:52, d.jagodic via rsyslog > > (<rsyslog@lists.adiscon.com>) escribió: > >> That's right, after the reset there is no warning on the first "Start > >> PLC now!" but after the second ... a warning/ error 2119 appears. > >> > >> On the second attempt, the function write fails with errno=EPIPE. > >> > >> written = write(pChildCtx->fdPipeOut, ((char*)szMsg) + offset, > >> len - offset); > >> if(written == -1) { > >> if(errno == EINTR) { > >> continue; /* call interrupted: retry write */ > >> } > >> if(errno == EPIPE) { > >> LogMsg(0, RS_RET_ERR_WRITE_PIPE, LOG_WARNING, > >> "omprog: program '%s' (pid %ld) terminated; > >> will be restarted fd=%d", > >> pData->szBinary, (long) > >> pChildCtx->pid,pChildCtx->fdPipeOut); > >> cleanupChild(pData, pChildCtx); /* force restart in > >> tryResume() */ > >> ABORT_FINALIZE(RS_RET_SUSPENDED); > >> } > >> > >> The question is why is this happening? > >> > >> I don't understand how you are trying to use omprog. Attaching the > >> contents of your script could help us better understand your use case. > >> > >> When the PLC is started, the message "Start PLC now!" appears in the > >> messages, and then the script should be executed. > >> The script writes only the text to a file. > >> The script and rsyslog configuration has not changed since versions 8.13 > >> and 8.29. There was no such warning/ error 2119 in those versions. > >> > >> > >> rsyslog.conf - general configuration > >> > >> rsyslog_user.conf - user configuration > >> > >> usrevent.conf - event configuration > >> > >> rsysevent32790 .sh- event script > >> > >> Regards > >> > >> Drasko Jagodic > >> > >> > >> Am 16.06.2022 um 19:55 schrieb Joan Sala: > >>> The warning message simply indicates that rsyslog has detected that > >>> the program (.rsysevent32790.sh) has exited. > >>> > >>> The way omprog is intended to be used is as follows: it launches the > >>> program attaching a pipe to its stdin, the program should continuously > >>> read lines (logs) from the pipe, until the pipe gets closed by rsyslog > >>> (eof reading from it). If the program exits before that, rsyslog will > >>> report that warning message and try to restart the program. > >>> > >>> I don't understand how you are trying to use omprog. Attaching the > >>> contents of your script could help us better understand your use case. > >>> > >>> Regards > >>> > >>> Joan Sala > >>> > >>> > >>> On Mon, Jun 13, 2022, 09:20 d.jagodic via rsyslog > >>> <rsyslog@lists.adiscon.com> wrote: > >>> > >>> Hi, > >>> > >>> In the embeded system we use rsyslog 8.2010.(but the same si in > >>> 8.2204) > >>> > >>> Is it possible to prevent the cause of the following warnings? > >>> > >>> rsyslogd: omprog: program '/tmp/.rsysevent32790.sh' (pid 29661) > >>> terminated; will be restarted [v8.2204.1 try > >>> https://www.rsyslog.com/e/2119 ] > >>> rsyslogd: action 'action-34-omprog' suspended (module 'omprog'), > >>> retry > >>> 0. There should be messages before this one giving the reason for > >>> suspension. [v8.2204.1 try https://www.rsyslog.com/e/2007 ] > >>> rsyslogd: action 'action-34-omprog' resumed (module 'omprog') > >>> [v8.2204.1 > >>> try https://www.rsyslog.com/e/2359 ] > >>> > >>> > >>> In parallel with the execution of the script, snmp-trap is sent, > >>> > >>> currently we have a situation where the script is executed once, > >>> but the > >>> snmp-trap is sent twice with an interval of about 1 second. > >>> > >>> > >>> Kind regards > >>> > >>> Drasko > >>> _______________________________________________ > >>> rsyslog mailing list > >>> https://lists.adiscon.net/mailman/listinfo/rsyslog > >>> http://www.rsyslog.com/professional-services/ > >>> What's up with rsyslog? Follow https://twitter.com/rgerhards > >>> NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a > >>> myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT > >>> POST if you DON'T LIKE THAT. > >>> _______________________________________________ > >> rsyslog mailing list > >> https://lists.adiscon.net/mailman/listinfo/rsyslog > >> http://www.rsyslog.com/professional-services/ > >> What's up with rsyslog? Follow https://twitter.com/rgerhards > >> NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad > >> of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you > >> DON'T LIKE THAT. _______________________________________________ rsyslog mailing list https://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com/professional-services/ What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.