Skip to content

Instantly share code, notes, and snippets.

@schlomo
Last active January 2, 2016 15:38
Show Gist options
  • Save schlomo/8324351 to your computer and use it in GitHub Desktop.
Save schlomo/8324351 to your computer and use it in GitHub Desktop.
Simple Upstart Service to record incoming UDP streams into time-stamped files.
# 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