I need to set a time limit for a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I need to set a time limit for a script
# 1  
Old 12-01-2008
I need to set a time limit for a script

Hello Folks,
I have been asked to write a test script which can be run by students. the script should have a time limit.

I have almost completed it except the bit of timing!

I've seen something like this:

Code:
on_timeout()
{
echo "$USER $score " >> theresult.txt
echo "Time out! Exit..."
exit 3
}
 
trap 'on_timeout' SIGALRM
 
#
#the test script goes here
#
#


But I do not know how to set the timer which will send SIGALRM when it goes off

Any help, please

Sultan
# 2  
Old 12-01-2008
Perhaps (untested):

Code:
sleep 1200 && kill -ALRM $$ &

# 3  
Old 12-02-2008
i haven't found any thing about that if u found tell me please
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Set hard block limit for user using quota

hi all, i have installed quota on my centos 7 machine and its what im after (setting size limit on users, so they cant fill the hard drive) i want to now make this part of my create user script for my sftp server so i want to do a echo and a read command so i capture the limit they enter... (0 Replies)
Discussion started by: robertkwild
0 Replies

2. Shell Programming and Scripting

Time out set in perl script

Hi, I am preparing a perl script, which will run some commads on remote Linux servers. I have a file contains all the servers names one by one like below vi servers.txt srv1 srv2 srv3 Now, I need to prepare a perl script to ssh (or)rsh to each server in the above... (1 Reply)
Discussion started by: kumar85shiv
1 Replies

3. Shell Programming and Scripting

How to set end limit while copying files of a range??

I have files being generated in format A20140326.00........ to A20140326.24............. I need to copy these hourly basis from one location to another. Eg. If i copy from 14 to 19 the hour, I use wildcard as A201403226.1*. Requirement is : I need to copy from 06 hour and wil run the script... (1 Reply)
Discussion started by: Saidul
1 Replies

4. Shell Programming and Scripting

How to set character limit on READ?

Hello, I created the following (snippet from larger code): echo -n "A1: " read A1 VERIFY=$(echo -n $A1|wc -c) if ; then echo -e "TOO MANY CHARACTERS" fi echo -n "A2: " read A2 echo -n "A3: " read A3 echo -e "Concat: $B1/$B2/$B3" Basically what it does is it... (4 Replies)
Discussion started by: jl487
4 Replies

5. UNIX for Advanced & Expert Users

Time limit on ifconfig wlan0 down?

Is there a time limit ifconfig wlan0 down? I used that command to take my wireless down. sudo ifconfig wlan0 downWhen I came back about 6 hours later it was working without me bringing my wireless back up. I am the only one that uses my computer or that knows the root password. (0 Replies)
Discussion started by: cokedude
0 Replies

6. Shell Programming and Scripting

csh shell script 'set' argument limit?

Hi , I have a script that is causing a problem that led me to think if there is a limit to the number of arguments for 'set' command in csh shell script. Here is my script: #!/bin/csh -f set top = design_top #1 set v_mbist = ( sim_mbist/*.v ) #2 set v_simlist = ( -v... (2 Replies)
Discussion started by: return_user
2 Replies

7. UNIX for Dummies Questions & Answers

ldapsearch time limit

We have an application that uses Active directory to authenticate the users. the admins of the app. were complaining because the windows domain controller they are going against is not very stable. I wrote a shell script using ldapsearch to look up a user against the domain controller their app... (2 Replies)
Discussion started by: jayjabour
2 Replies

8. Solaris

How to set Root password age limit in Solaris 9/10

Hi Friends, Can anyone tell me how can I set the password age limit for root user to 14 days....??? Also would like to add following for root password; min-alpha --- 4 min-other --- 1 min-length -- 6 min-diff ----- 3 How can I do these on command line....??? Regards, jumadhiya (7 Replies)
Discussion started by: jumadhiya
7 Replies

9. AIX

failed login time limit

Hello, we had a situation where an account was locked out due to too many failed login attempts. From the logs (failedlogin, etc) it appears that AIX 'remembered' the failed login attempts from the past month or so. does anyone know where this is set, or how long it will remember the number of... (2 Replies)
Discussion started by: zuessh
2 Replies

10. UNIX for Dummies Questions & Answers

Limit login time...

How do I limit the amount of idle time an account gets on solaris? Thanks. VJ (2 Replies)
Discussion started by: vancouver_joe
2 Replies
Login or Register to Ask a Question