K
K
Konstantin2016-06-27 21:15:57
linux
Konstantin, 2016-06-27 21:15:57

How to terminate a bash script after a certain time?

Hi all!
There is a simple sh script like this:

#!/bin/bash  
cvlc rtsp://root:[email protected]:554/axis-media/media.amp :sout="#std{access=file,mux=asf,dst=/media/rec/$(date +'%y-%m-%d--%H_%M').avi}" --run-time 3605

Crohn stupidly once an hour runs through this VLC script to record the stream. The recording lasts 3605 sec. Everything is simple here.
Tell me what to add to the script so that the sh script process ends, for example, after 1 minute, and VLC continues to write. Because now I have these sh processes just piling up.
Not good at scripting. Please do not judge strictly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-06-27
@NGNeer

add cvlc to cron right away,
or send cvlc to background with &

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question