Shell script for time count
Hi Guys,
I want a syntax or suggestion for implement below. -->start x command and count time --->send y cmd after 20 mins and stop count time ---> send z cmd and start count time. Thanks in advance |
It will be good if you share the script that you have written so far. Let us know where exactly you are stuck and what exactly you are trying to do?
|
Below is my script what i am trying but it is not working because timeout will kill the process after 20 minutes and executes further commands. I don't want to kill the process it has go to execute further commands.
#!/bin/sh timeout 20m sh /dv4/delete-dv4.sh PID=`echo $$` if ps -p $PID > /dev/null then echo "$PID is running" fi timeout 20m sh /dv4/delete-dv4.sh PID=`echo $$` if ps -p $PID > /dev/null then echo "$PID is still running" fi kill -s 15 $PID 1. My requirement is sh /dv4/delete-dv4.sh has to be run up to 20 minutes and count time in X varable 3. After 20 minutes i need to send My process running 4.After 20 minutes again i need to be start sh /dv4/delete-dv4.sh and start count time from where it stopped earlier (In x Variable) 5. After 20 minutes i need to send My process is still running 6 If count time reached 40 minutues 7 kill the process |
Quote:
|
This may do:
Code:
TX=`date +s` |
All times are GMT -5. The time now is 04:12 AM. |