LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash Script: Kill a process after fixed time. (https://www.linuxquestions.org/questions/linux-newbie-8/bash-script-kill-a-process-after-fixed-time-4175413758/)

bruno.miranda 06-27-2012 09:55 PM

Bash Script: Kill a process after fixed time.
 
Hello All,
I want to execute a program using a shell script, but if the program does not terminates after a certain amount of time (lets say 5 m), I want to kill it in order to execute the same program again (my program sometimes terminates before 5 min). When the program terminates I want to save its results. So, my newbie shell script is the following...

num=1
for (( i = 1; i <= 100; i++ ))
do
./MyProgram
mv result.txt /home/bruno/output_I/result_00$0.txt
((num=num+1))
done

Regards!

Tinkster 06-28-2012 02:48 PM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

Follow-ups here: http://www.linuxquestions.org/questi...me-4175413756/


All times are GMT -5. The time now is 10:53 AM.