09-23-2002
executing a script for a certain amount of time
I am writing a script that takes two parameters: the name of another script and an integer that represents a number of seconds. The script must execute the second script (first parameter) for the specified number of seconds (second parameter), suspend it for the same number of seconds, and continue this cycle until the specified script is finished.
For example:
pulse input.ksh 2
I have no idea how to run a script for a specified amount of time. I have looked at the "at" and "crontab" commands but these don't seem appropriate. Anybody know of a solution?
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I do not have the luxery of a server that i can try on, so i had to post my qn here.
Say i have two jobs in the cron table, the jobs are scheduled 2 mins apart. Assuming the first jobs does a lot of operations and takes > 2 mins. Will the second job be executed? Will Unix actually have a queue... (3 Replies)
Discussion started by: new2ss
3 Replies
2. Shell Programming and Scripting
HI ,
I have a list1 which consists of data that i have to search and a list2 which has the files that need to be searched .So basically i am using list1 on list2 to see if list1 data is present if found replace it .I have written the code using foreach loop for each list .This is taking the... (1 Reply)
Discussion started by: madhul2002
1 Replies
3. Shell Programming and Scripting
Hi,
Unexpectedly, the function below doesn't seem to work
when called a second time. The output shows that when
the function is called the first time, it works as expected
but when it is called a second time, the loop that processes
the options passed to the function, with the while loop,... (2 Replies)
Discussion started by: ASGR
2 Replies
4. Programming
Hi All,
This Monday 15th March 2010, i have faced a weired issue with my Perl script execution, this script is scheduled to run at 1 minute past midnight on daily basis ( 00:01 EST ) generally for fetching previous business date , say if it is Monday it should give last Friday date, for Tuesday... (0 Replies)
Discussion started by: ravimishra
0 Replies
5. Shell Programming and Scripting
Hello all,
Hopefully someone can point me in the right direction...
I have a script written in bash which is pretty basic and just stop/starts various services based on particular conditions. What I am trying to build is a reporting type function which will send out an email with various stats... (3 Replies)
Discussion started by: systrex
3 Replies
6. Shell Programming and Scripting
hi,
i have written an shell script which reads an folder and write the filenames to another file:
here is the script:
#!/bin/bash
find /var/www/vhosts/remixland.de/web_users/stream001/jingle15 -type f -name "*.mp3" > /etc/shoutcast001/example.lst
killall -USR1 sc_trans_linux001... (1 Reply)
Discussion started by: maydo
1 Replies
7. UNIX for Advanced & Expert Users
I would like to kill a process after a certain amount of time. Can I please get some ideas on how to do this? (9 Replies)
Discussion started by: cokedude
9 Replies
8. Shell Programming and Scripting
Hi
Am having file.ksh as below
wc -l file1.txt
wc -l file2.txt
wc -l file3.txt
wc -l file4.txt
i want all the commands in this file to execute in same time
please help
Thanks in advance (1 Reply)
Discussion started by: ragu.selvaraj
1 Replies
9. Shell Programming and Scripting
Hi,
I have been trying to do a small fun project for myself.
I want to run a command for 45 seconds.
And to get the final output of this command, the script requires I push the "q" key on my keyboard and then the final output file becomes available.
I tried the following script. But it... (12 Replies)
Discussion started by: jacobs.smith
12 Replies
10. Shell Programming and Scripting
I have a script that checks if the script has been ran with sudo.
If the script is not ran as sudo, the current script is being executed with exec sudo bash.
You are asked for a password, you type in the password, success. Everything is perfect - the commands inside the script are ran as sudo.... (1 Reply)
Discussion started by: boqsc
1 Replies
catch(n) Tcl Built-In Commands catch(n)
__________________________________________________________________________________________________________________________________________________
NAME
catch - Evaluate script and trap exceptional returns
SYNOPSIS
catch script ?varName?
_________________________________________________________________
DESCRIPTION
The catch command may be used to prevent errors from aborting command interpretation. Catch calls the Tcl interpreter recursively to exe-
cute script, and always returns without raising an error, regardless of any errors that might occur while executing script.
If script raises an error, catch will return a non-zero integer value corresponding to one of the exceptional return codes (see tcl.h for
the definitions of code values). If the varName argument is given, then the variable it names is set to the error message from interpret-
ing script.
If script does not raise an error, catch will return 0 (TCL_OK) and set the variable to the value returned from script.
Note that catch catches all exceptions, including those generated by break and continue as well as errors. The only errors that are not
caught are syntax errors found when the script is compiled. This is because the catch command only catches errors during runtime. When
the catch statement is compiled, the script is compiled as well and any syntax errors will generate a Tcl error.
EXAMPLES
The catch command may be used in an if to branch based on the success of a script.
if { [catch {open $someFile w} fid] } {
puts stderr "Could not open $someFile for writing
$fid"
exit 1
}
The catch command will not catch compiled syntax errors. The first time proc foo is called, the body will be compiled and a Tcl error will
be generated.
proc foo {} {
catch {expr {1 +- }}
}
KEYWORDS
catch, error
Tcl 8.0 catch(n)