
krish89
Novice
Aug 6, 2012, 5:40 AM
Post #1 of 13
(4441 views)
|
Help for stopping a command in script
|
Can't Post
|
|
Hi I'm a beginner in perl programing and got stuck at one point in my code. The script is used to run a cpp code that will acquire data from an acquisition card. The problem is I can't stop the script which calls the acquisition program to stop at some point of time unless I press ctrl C. So I tried with the script which I have given below to do the process, but it is not stopping. the condition which I used is also given in the shorter version of my code. Please tell me what I can do to stop that command. Thanks in advance, kk.
#!/usr/bin/perl ($no_of_files, $sourcename) = @ARGV; $no=0; my $n_secs = 50; my $start = time; while($no < $no_of_files) { #..............................# $rec="/home/test"; printf "$rec\n"; if (time-$start >= $n_secs){ kill($rec) } system($rec); #..............................#
|