LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 01-08-2010, 08:11 AM   #1
tcegrid
LQ Newbie
 
Registered: Apr 2007
Posts: 10

Rep: Reputation: 0
running back ground jobs in bash


#!/bin/bash
jobid=$1
freq_count=$2

while true; do
TGT_NODE=`qstat | grep -w $jobid | awk '{print $8}'| cut -d"@" -f2 | cut -d"." -f1`
if [ -z "$TGT_NODE" ]
then
echo "Job $jobid not found"
exit 1
fi
rsh $TGT_NODE file_copy.sh $jobid
echo "freq_count=$freq_count"
sleep $freq_count
done

I am trying to execute the above script as back ground job
./cfx_outfile.sh 1001 3 &
also
nohup sh cfx_outfile.sh 1001 3 > cfx.out &

In the both cases the as soon as the execution reaches sleep command it shall not be precede further any more.

May I know the reason for why is this happening?

But this same script works perfectly when I run as bash script. Finding issue only when I ran as background job.

Last edited by tcegrid; 01-09-2010 at 04:40 AM. Reason: typo in variable name
 
Old 01-08-2010, 08:21 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Where are you assigning a value to the variable "freq_count"?
 
Old 01-09-2010, 04:45 AM   #3
tcegrid
LQ Newbie
 
Registered: Apr 2007
Posts: 10

Original Poster
Rep: Reputation: 0
typo the variable name count. actually it is freq_count only.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub ..changing default back ground image?? stratotak Debian 4 12-07-2017 11:21 PM
[SOLVED] [bash]Pick up process running in back up by another terminal... RaptorX Linux - General 5 09-02-2009 02:29 PM
LXer: Watch Your Back(ground) LXer Syndicated Linux News 0 07-17-2009 09:21 PM
what is command to display the process which is running in the back ground vinaykori Linux - General 2 02-07-2008 10:35 PM
running jobs in background in bash markhod Linux - Software 2 10-08-2003 08:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 01:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration