on 10-09-2009 6:07 AM
Hi,
We are trying to execute multiple commands via "Operating System Command Before/After Message Processing".
When we use single command say for example cp or mv (copy or move) the commands get executed fine.
eg: cp %F /var/opt/data/outbound/Test/Dummy.txt
/this works fine/
when we club commands together or try to redirect the outputs of commands, none of the commands get executed.
eg:
cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
or
wc -l %F > /var/opt/data/outbound/Test/Dummy.txt
Is it possible to execute multiple commands or redirect the output of commands without using a shell script? The PI server we are working on iis hosted on UNIX environment.
Hi,
have you tried putting all the commands you need inside a script, such as .bat (for MS Win Operating system) or .sh (for *nix Operating Systems)?
Under Unix, you could use something like this, inside script.sh:
#!/bin/sh
cp $1 /var/opt/data/outbound/Test/Dummy.txt
rm $1
wc -l $1 > /var/opt/data/outbound/Test/Dummy.txt
in the Operating System Line, you will call the script as /<yourWorkingDirectory>/script.sh %F
Hope this help!
Regards,
Antonio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Harleen,
try like this
cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
instead of semicolon try this
(1) &
command1 & command2
Execute Command1 and then execute Command2
(2) &&
command1 && command2
Runs the command2 only when command1 doesn't Complete successfully
(3) ||
command1 || command2
Runs the second command if the first command had an error
(4) ()
(command1 || command2) || (command3 & command4)
Defines the order in which commands are to be executed
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suraj,
thanks for replying. I tried using '&' but still facing the same issue.
Standalone both these commands work:
cp %F /var/opt/data/outbound/Test/Dummy.txt
mv %F /var/opt/data/outbound/Test/Dummy.txt
but when i try combining them, the command simply stops working.
cp %F /var/opt/data/outbound/Test/Dummy.txt & mv %F /var/opt/data/outbound/Test/Dummy.txt
I tried redirecting the output to a log file, to see if there were any errors encountered. But re-direction also doesn't seem to be working.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.