nohup - sub job in script not executing until I exit
My job is launched using this command: I'm at home and having VPN drops so I used nohup and background.
nohup perf_mon -c rating_4_multi,cfg &
The main script is PID 26119, and the sub task under it is 26118 which is not running - just sits there. 26119 runs forever but nothing else runs. I exit the session once and it appears to kill the 26119 task and trigger the sub task 26118 to run.
I tried doing that a second time and I got nothing so I sudo'd back in and exited twice - I ended up with a HUP command in the sub job log and get no execution. I exited twice because the first exit didn't appear to work. I might have been okay to do a single exit but it's too late now. Gotta rerun the job. (Takes several hours so this is really painful).
---------- Post updated at 10:36 PM ---------- Previous update was at 09:00 PM ----------
Set the job up again and exitted twice and got the "You have jobs running" message but the sub job didn't HUP. Sudo'd back in and exitted twice a couple times but can't get the sub job to launch this time. Might be because the sub job is not ready to run, and the exit is inneffective just yet. Mystifying....
Last edited by pludi; 08-15-2010 at 08:55 AM..
Reason: code tags, please...
I can add some more - I launch the script using nohup and it executes a series of lines then stops at a particular line while that line executes.
This line calls a sub - script that gathers data for a log file. If I exit too soon during the execution of the sub script it sends a hup to the sub script and that sub script stops with no data in the log - say after an hour. I waited 5 hours before that to exit and the sub script was still hanging but it ended without a hup and put the log data in the log file.
This sub script runs for an undetermined amount of time - I have no idea how long it runs as I can't tell if it's doing anything or waiting or hanging.
If anyone can tell me how I can tell if the sub script is actually doing anything or just hanging that would be great. And tell me why the sub script would get a hup when I used nohup to launch the original script.
Also after the sub script stops, a few kill commands from the original script do execute. So why would the sub script stop working with a hup and the kill commands stil get executed?
i have a "if .. then exit end " in s shell script on remote servers.
now the connection to the remote server got killed after i run this script on the remote servers. How do i run this script on remote hosts and still keep remote connections alive after executing the script.
Thank you. (10 Replies)
Hi,
I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script.
My intension is to execute... (4 Replies)
Hello All,
I need to run a set of scripts, say 50 of them, parallely. I'm running these 50 scripts, from inside a script with the help of 'nohup' command.
1.The fifty scripts are stored in a separate file.
2.In a master script, i'm reading every line of the file through loop and executing... (4 Replies)
Hi All,
I have one shell script start.sh which executes another shell script test.sh something like below :test.sh -param1 -param2
In the test.sh there is one command for removing file:rm file1.bak
I want whenever I execute start.sh, it will execute test.sh and if it finds string rm... (7 Replies)
Hi,
Is there any way to achieve that my script should always execute like:
nohup ./scriptname >nohup.out &
even if i execute ./scriptname , it should be converted to nohup ./scriptname >nohup.out & and then execute.
How i can achieve this?
Thanks in advance (2 Replies)
Hi all,
I am trying to exit a shell script (c shell) while invoking a job (service) that must run in the background:
......
/mydir/runservice &
exit
......
There are downstream jobs and scripts that need to be run, but they all 'wait' for the script to exit. The script 'hangs' and... (3 Replies)
Hi,
I am kinda confused with this, am not sure what is happening
i have a script say test.sh
----------
cat myfile | while read line
do
exit 2
done
echo "out of loop"
-----------
as it is evident, the exit should cause the script to terminate ,hence producing no output for the... (1 Reply)
I am trying to submit background jobs using the nohup command on a client system where my session is running under a "master shell" (BASH). If I try to nohup the actual job (ie: nohup MYJOB.BAT > MYJOB.LOG 2>&1 &) the command will fail with a return code of 126 and a "permission denied" message.... (0 Replies)