Skip to content

Instantly share code, notes, and snippets.

@johndel
Last active December 10, 2015 16:08
Show Gist options
  • Save johndel/4459006 to your computer and use it in GitHub Desktop.
Save johndel/4459006 to your computer and use it in GitHub Desktop.
Start, restart and stop crtmpdserver :) My Edition! I love it.
#!/bin/bash
case $1 in
start)
echo "Starting crtmpd...";
cd /root/crtmp/;exec ./crtmpserver ./configs/mine.lua &
echo "crtmpd started.";
sleep 2;
echo $(lsof -t -i :1935) > /var/run/crtmpd.pid;
echo $(lsof -t -i :1935);
;;
stop)
echo "Stopping crtmpd...";
kill `lsof -t -i :1935`;
kill `cat /var/run/crtmpd.pid`;
echo "crtmpd stopped";
;;
restart)
echo "Restarting crtmpd...";
kill `lsof -t -i :1935`;
kill `cat /var/run/crtmpd.pid`;
cd /root/crtmp/;exec ./crtmpserver ./configs/mine.lua &
echo "crtmpd restarted.";
sleep 2;
echo $(lsof -t -i :1935) > /var/run/crtmpd.pid;
echo $(lsof -t -i :1935);
;;
*)
echo "usage: crtmpd {start|restart|stop}" ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment