Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon5.gif   running more then one shell command when new entries is submitted, posted by kenzo Abrahams on Tue Oct 27 11:03:49 2015 
    icon2.gif   Re: running more then one shell command when new entries is submitted, posted by kenzo Abrahams on Tue Oct 27 11:14:16 2015 
    icon2.gif   Re: running more then one shell command when new entries is submitted, posted by Stefan Ritt on Tue Oct 27 11:19:41 2015 
       icon2.gif   Re: running more then one shell command when new entries is submitted, posted by kenzo Abrahams on Tue Oct 27 11:23:36 2015 
          icon2.gif   Re: running more then one shell command when new entries is submitted, posted by Andreas Luedeke on Tue Oct 27 12:20:16 2015 
             icon2.gif   Re: running more then one shell command when new entries is submitted, posted by kenzo Abrahams on Wed Oct 28 11:11:27 2015 
Message ID: 68170     Entry time: Wed Oct 28 11:11:27 2015     In reply to: 68165
Icon: Reply  Author: kenzo Abrahams  Author Email: kenzoabrahams@gmail.com 
Category: Question  OS: Linux  ELOG Version: 3.1.1 
Subject: Re: running more then one shell command when new entries is submitted 

Hi Andreas

This worked perfectly thank you.

Andreas Luedeke wrote:
As far as I know ELOG is recognising a configuration line as a comment only when it starts with a ';'.
I can assure you that ELOG does not treat the rest of the line as a comment when you use a ';' within a $shell() command: I do it a lot and it works fine. Here's a simple, generic example using the bash:

Preset Author = $shell(if [ $short_name = "Anonym" ] ;then echo $Author;else echo \"$long_name, $Author\";fi)
It adds $long_name to the Author field for non-anonymous entries.

Cheers Andreas

kenzo Abrahams wrote:

If i put the ';' into Execute the rest of the command becomes a comment thats why i was trying to use '&&' instead. If I encapulate the whole command in "" or '' then both commands are executed but the files im trying to write to gets created but no data is piped into it. When I use Execute with one command and pipe its output to a file everything works fine though.

Stefan Ritt wrote:

The command is passed to your shell, and some shells except more than one command. Most Linux shells accept commands separated by ';', which you can try yourself by entering for example: ls *.c; ls*.h

kenzo Abrahams wrote:

Hi

Im just curious is it possible to run more then one command using Execute new = <command> or will i have to run a script to run muliple commands.

I tried using '&&' to seperate more then one command but it seems that the first one only gets executed and the rest are just ignored.

Regards

Kenzo

 

 

 

 

ELOG V3.1.5-fe60aaf