Linux script error

When i execute tar command on the linux shell it works fine but when i execute it from bigfix action script it does not work and create /tmp/error.txt as folder instead of file

Is it something & is not recognized by bigfix action script ?

run “tar -cvzpf /tmp/bkp5.tar.gz --exclde=/root/Test/sample1.log /root/Test &> /tmp/error.txt”

Try writing the command to a file to see if its comes out as expected…or you could try writing it to a shell script and then call the shell script. Pretty sure I’ve used & in Windows CMD commands with no issues so I don’t think you’ve need to % encode it.

while i call with shell script it works , but i need to provide parameter in the tar command and have to run this from action only as location of back file , file / filesystem are dynamic.

[root@mycloud0190 ~]# tar -cvzpf /tmp/bkp5.tar.gz --exclde=/root/Test/sample1.log /root/Test &> /tmp/error.txt [root@mycloud0190 ~]# ls -l /tmp/error.txt -rw-r--r-- 1 root root 115 Jul 15 18:30 /tmp/error.txt [root@mycloud0190 ~]# more /tmp/error.txt tar: unrecognized option '--exclde=/root/Test/sample1.log' Try `tar --help' or `tar --usage' for more information. [root@mycloud0190 ~]#

I’m not sure - is the parameter ‘exclde’ or ‘exclude’ ?

1 Like

i did the spell mistake to generate the error code - but & is not running from bigfix action script.

I’m actually out sick today and haven’t logged in to my lab, but I’d note that at least on Windows, the output redirection is a function of the shell (cmd.exe) not the individual application that’s executing. I suspect it’s the same case on Linux - the “&>” would be something interpreted by /bin/bash, not by /bin/tar.

Also, if you’re backgrounding the application, I’m not sure I’d actually expect the output to end up in the /tmp/error.txt if there were a failure.

I’d try using the shell to run it instead, something like

run /bin/sh --login -c "tar -cvzpf /tmp/bkp5.tar.gz --exclude=/root/Test/sample1.log /root/Test 2> /tmp/error.txt"
3 Likes

it worked thank you…

2 Likes