diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-15 18:42:08 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-15 18:42:32 -0400 |
commit | 34aa7d88c470a96b476bc11a5aacb364cc9bfad3 (patch) | |
tree | aa11b5584c78348937e506604b569b2796f324de | |
parent | 9e48363b4022bfc477a0de7cabf9e85cf16531e0 (diff) |
write better systemd units
-rw-r--r-- | freenect-server.service | 4 | ||||
-rw-r--r-- | freenect-server.sh | 2 | ||||
-rw-r--r-- | freenect-server.socket | 8 |
3 files changed, 12 insertions, 2 deletions
diff --git a/freenect-server.service b/freenect-server.service index 77df284..5a2d4e2 100644 --- a/freenect-server.service +++ b/freenect-server.service @@ -1,12 +1,14 @@ [Unit] Description=Kinect media streamer After=network.target +Requires=freenect-server.socket [Service] Type=simple User=alarm -ExecStart=/home/alarm/freenect-server/freenect-server +ExecStart=/home/alarm/freenect-server/freenect-server fd systemd Restart=always [Install] WantedBy=multi-user.target +Also=freenect-server.socket diff --git a/freenect-server.sh b/freenect-server.sh index 721243c..9328573 100644 --- a/freenect-server.sh +++ b/freenect-server.sh @@ -11,7 +11,7 @@ mkfifo $t/video.mjpg mkfifo $t/depth.mjpg ( freenect-server--kinect -v $t/video.rgb24 -d $t/depth.rgb24; echo "EXITED: freenect-server--kinect: $?") & pids+=($!) -( multipart-replace-http-server 5800 $t/video.mjpg $t/depth.mjpg; echo "EXITED: freenect-server--http: $?") & pids+=($!) +( multipart-replace-http-server "$1" "$2" $t/video.mjpg $t/depth.mjpg; echo "EXITED: freenect-server--http: $?") & pids+=($!) rm -f {depth,video}.{avi,mjpg} ( ffmpeg -loglevel warning -pixel_format rgb24 -s 640x480 -f rawvideo -i $t/video.rgb24 -q:v 1 -f mpjpeg - > $t/video.mjpg; echo "EXITED: ffmpeg video: $?") & pids+=($!) ( ffmpeg -loglevel warning -pixel_format rgb24 -s 640x480 -f rawvideo -i $t/depth.rgb24 -q:v 1 -f mpjpeg - > $t/depth.mjpg; echo "EXITED: ffmpeg depth: $?") & pids+=($!) diff --git a/freenect-server.socket b/freenect-server.socket new file mode 100644 index 0000000..4b98eca --- /dev/null +++ b/freenect-server.socket @@ -0,0 +1,8 @@ +[Unit] +Description=Kinect media streamer socket + +[Socket] +ListenStream=5800 + +[Install] +WantedBy=sockets.target |