How to idle before executing a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to idle before executing a script
# 1  
Old 04-15-2010
How to idle before executing a script

Hi

I want to put a timer or whatever it could be ,a similar to sleep which will make the script to wait before executing it self

like
Code:
#!/bin/bash

sleep 30 #or another comand which will wait 30 s. and than proceed with  code but that timer should not freeze the OS .

shell code

done

I hope i was clear enough

Best on advance
# 2  
Old 04-15-2010
sleep is fine - it does not freeze the OS. Try it out.
# 3  
Old 04-15-2010
Quote:
Originally Posted by zaxxon
sleep is fine - it does not freeze the OS. Try it out.
Thanks on reply

But im implicating the script on a startup of a busybox environment ,and that causes the freeze on start up .
# 4  
Old 04-15-2010
Or add this before code

Code:
count=30
while [ $count -ge 0 ]

do
echo "$count    seconds to GO"
count=`expr $count - 1`
sleep 1
done
echo "Off we go!"

# 5  
Old 04-15-2010
Put the starting script with the sleep etc. in the background then (nohup startscript.sh &).
# 6  
Old 04-15-2010
Quote:
Originally Posted by zaxxon
Put the starting script with the sleep etc. in the background then (nohup startscript.sh &).
well i think im sounding like the movie star Zac :P ,but nohup is also not supported on my busybox system .

But i think i solved ,i`ll put a script without sleep and call other script from that only if i need them .

But if someone could help me on another logic ,how to count if a command is being processed for a long time ,than if yes kill it .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing Oracle script from UNIX Script

Hi, I am new to UNIX and want to execute oracle script from unix script. I have written below script but i am getting below error. #!/bin/bash file="/home/usr/control/control_file1" while read line do #$line=@$line #echo $line sqlplus tiger/scott@DB @$line exit #echo "$line" done... (3 Replies)
Discussion started by: vipin kumar rai
3 Replies

2. Shell Programming and Scripting

Kill idle Process using a script

Hi, I need a script that can automatically kill all processes named "webrepn" and "webrebw" if idle for more than 30 minutes. Then I will have a Cron Job to run the script every night or 2-3 times a day depends on how this script helps. Right now, I run "ps -ef | grep webrebn" and "kill -9... (7 Replies)
Discussion started by: MaggieL
7 Replies

3. Shell Programming and Scripting

Help on shell script conditional execution when CPU Idle > 60%

I need a shell script that will monitor a few conditions and not execute until the these conditions are met. The problem I'm having is that I can not perform a database snapshot (backup) of a sybaseIQ database unless the CPU Status Idle % is above 60% or the snapshot (backup) fails. If... (2 Replies)
Discussion started by: pancona99
2 Replies

4. Shell Programming and Scripting

Kill idle script is killing unnecessarly

Hi All,I have a problem with my kill idle script.my script is supposed to kill the user sessions which are idle for more than 2 hours.But is is killing the sessions which are idle for less than 2 hrs also.I dont know the exact time after which the script is killing,but it is less than 2 hours i am... (3 Replies)
Discussion started by: prabhu_kumar
3 Replies

5. AIX

Kill IDLE Process using script !!!

Dear Friends , I am using DB2 database in AIX 5.3 server . In my server some IDLE process are generated after several times which I need to kill it manually each and every time . The process I query like following : root@bagpuss $ ps auxw|sort -r +3|head -10 USER PID %CPU %MEM ... (3 Replies)
Discussion started by: shipon_97
3 Replies

6. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

7. Shell Programming and Scripting

script for killing idle users

I need a script that will look for idle users and kill there proc. (7 Replies)
Discussion started by: jdel80
7 Replies

8. HP-UX

Is there a script available to kill Idle users

My max user parm is set to 1050. I'm currently at 1038 this is causing major slow downs on the server. I looking for a way log off "idle" user logins with out having to do it individually. :confused: (5 Replies)
Discussion started by: rfmurphy_6
5 Replies

9. UNIX for Dummies Questions & Answers

How to run a script when your computer is idle

I am trying to run a script that I made when my computer is idle. How do I go about doing this. Thanks :) (4 Replies)
Discussion started by: rehansaeed
4 Replies

10. UNIX for Dummies Questions & Answers

logoff idle user script

Will someone please share a script with me that will read in each line of the who -u output and if idle time is more than 50 min, execute a kill on the PID? This is what I have so far: who -u | cut -c 40-56 I am comfortable in the korn shell, but I can broaden my horizons if you've got... (4 Replies)
Discussion started by: michieka
4 Replies
Login or Register to Ask a Question