I have a bash script with doing lot of things called script.sh
:
#!/bin/bash
#It
#Is
#Doing
#Things
Is there a way that I be able to get the proccess of script and then kill it after 5 minutes?
Like:
#!/bin/bash
#Now here give pid of script.sh then kill it after 5 minutes
#It
#Is
#Doing
#Things
update
Imagin I have this script:
#!/bin/bash
while :
do
echo "line printed"
done
If we use these answers it doesn't show the output...
I want out put be printed and after 5 minutes cntrl + c
signal kill the process of bash...
Is this good idea?
PID=$$
kill -SIGINT $PID
Where should be put?