Update icecast2 FIP relay using HTTP/Json API http://zmpd.zered.net:8042/fip-metadata.mp3
python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init_script 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: fip-current
  4. # Required-Start: $remote_fs $network icecast2
  5. # Required-Stop: $remote_fs
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: Icecast2 FIP relay metadata update script
  9. # Description: Start updating Icecast2 metadatas using FIP radio wep API
  10. ### END INIT INFO
  11. DPATH=/PUT/SCRIPT/PATH/HERE
  12. SCRIPT="fip_current.py"
  13. DAEMON="${DPATH}/${SCRIPT}"
  14. CONFIG="${DPATH}/conf.ini"
  15. NAME="fip-current"
  16. DESC="fip-current update script"
  17. DAEMON_OPTS="-ul -c $CONFIG"
  18. PIDFILE="/run/fip-current.pid"
  19. set_path()
  20. {
  21. echo "DPATH variable not set or wrong in init_script";
  22. exit 1;
  23. }
  24. test -x $DAEMON || set_path
  25. . /lib/lsb/init-functions
  26. case $1 in
  27. start)
  28. log_daemon_msg "Starting $DESC"
  29. if $0 status >/dev/null
  30. then
  31. echo -n " allready running"
  32. log_end_msg 1
  33. else
  34. start-stop-daemon --quiet --start --background -m -p $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
  35. log_end_msg $?
  36. fi
  37. ;;
  38. stop)
  39. log_daemon_msg "Stopping $DESC"
  40. start-stop-daemon --stop -p $PIDFILE --remove-pidfile -x $DAEMON
  41. log_end_msg $?
  42. ;;
  43. restart)
  44. $0 stop
  45. $0 start
  46. ;;
  47. status)
  48. status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
  49. ;;
  50. *)
  51. echo "Usage: $0 {start|stop|restart|status}" >&2
  52. exit 1
  53. ;;
  54. esac