&g" /> Run a job in background for infinte time - The UNIX and Linux Forums
The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Linux Going Big Time and Prime Time Against Windows, UNIX (WSJ) (Addict 3D) iBot UNIX and Linux RSS News 0 06-21-2007 05:10 PM
Start time/end time and status of crontab job thambi Shell Programming and Scripting 3 05-16-2007 11:24 AM
How To Provide Time Sync Using Nts-150 Time Server On Unix Network? pesty UNIX for Advanced & Expert Users 2 03-22-2007 02:20 AM
background job babayeve UNIX for Dummies Questions & Answers 3 05-25-2005 11:08 AM
default time in Solaris 8 for time-wait eloquent99 UNIX for Dummies Questions & Answers 1 04-01-2003 10:45 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-29-2006
midhun_u midhun_u is offline
Registered User
  
 

Join Date: Jul 2006
Location: Paris, France
Posts: 8
Run a job in background for infinte time

Hello All,

I would like to know if it is possible to launch a job in background for infinite time.

example:

myScript.ksh
while true
do
( echo "(`date`)"; top -U user | grep 'Memory:' ) >> log &
sleep 1800
done

and when i do myScript.ksh & my log file is just updated for the first time and never again.

but when i do myScript.ksh it works kool.

could someone suggests me pls

tnx
  #2 (permalink)  
Old 09-29-2006
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Are you executing in background and then logging out? If so, try:

Code:
nohup myScript.ksh &

Regards.
  #3 (permalink)  
Old 09-29-2006
midhun_u midhun_u is offline
Registered User
  
 

Join Date: Jul 2006
Location: Paris, France
Posts: 8
No, iam leaving my session open.

Infact i just wanted to check the resources at certain time during weekdays.
  #4 (permalink)  
Old 09-29-2006
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Well, that's a strange behaviour, then...
Why don't you schedule it in a cron job?

Code:
00,30 * * * * myScript.sh > /dev/null 2>&1

And remove the while loop inside the script, of course
Regards.
  #5 (permalink)  
Old 09-29-2006
midhun_u midhun_u is offline
Registered User
  
 

Join Date: Jul 2006
Location: Paris, France
Posts: 8
the worst thing is that i am not admin. if i want to do that i have to request the sys admin and its big process flow ( request on homologation + tests + manager approval + request for prod).

i dont want go through the hectic process for this simple pgm.

will try to find another way.

tnx a lot

regards.
  #6 (permalink)  
Old 09-29-2006
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
I see... Well, try anyway the "nohup" solution, just in case, becasue your script seems to be OK.
Regards.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0