Last active
January 2, 2016 15:38
-
-
Save schlomo/8324351 to your computer and use it in GitHub Desktop.
Simple Upstart Service to record incoming UDP streams into time-stamped files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Service definition for Upstart, put into /etc/init | |
description "Record TS stream from VGADVIRecorder" | |
start on started autofs | |
stop on stopping autofs | |
respawn | |
# who else will have access | |
umask 0000 | |
# where to store the videos | |
chdir /nfs/some.nas.server/some/path/videos | |
# create video files as | |
setuid nobody | |
setgid nogroup | |
console log | |
script | |
while | |
socat -ly -lpudp_stream_recorder -T 5 -u \ | |
UDP-RECV:6002,range=1.2.3.4/32 \ | |
EXEC:'perl -MDate\:\:Format -w -n -e open($FILE,">:raw",time2str("%Y-%m-%d_%k-%M-%S.ts",time))unless(defined($FILE)); -e syswrite($FILE,$_);' | |
do | |
: | |
done | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment