2

In the below script, ivfstudio commands open a gui. Even launched as a background process, I need to close it first so that the next commands are executed. How to make it "really background" ?

#!/bin/sh

cmd=`ivfstudio ilv/my_app.iva -execute GenerateAll `;

(
$cmd & ;
echo "toto" ;
`sleep 30` ;
PID = `ps aux | grep -i ivfs | grep my_user| grep -i generateall | awk -F " " '{print $2}' \`;  ) ) ` ;
echo  $(PID) ;
`kill $(PID)` ;
)

exit

EDIT SOLUTION:

#!/bin/sh

cmd="ivfstudio my_project.iva -execute GenerateAll > /dev/null 2> /dev/null"

nohup $cmd &
echo "toto"

`sleep 30`
PID=`ps aux | grep -i ivfs | grep my_user| grep -i generateall | awk -F " " '{print $2}' `

echo  $PID
`kill $PID`


exit
4
  • I think you have to use: nohup nohup command &
    – gaanon
    Jul 31, 2014 at 10:57
  • cmd = 'ivfstudio my_project.iva -execute GenerateAll' nohup nohup $cmd & is not working... How shall I type it exactely ? Jul 31, 2014 at 12:08
  • @user62122 , thanks a lot, I made it work thanks to you. Jul 31, 2014 at 12:38
  • answers should be in the Answer box -- feel free to write one up yourself, or @user62122!
    – Jeff Schaller
    Aug 25, 2016 at 13:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.