Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### BEGIN INIT INFO
- # Provides: MOCP Application Instance
- # Required-Start: $all
- # Required-Stop:
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: starts instance of mocp
- # Description: starts instance of mocp using start-stop-daemon
- ### END INIT INFO
- case "$1" in
- start)
- if ! pidof -o %PPID mocp > /dev/null; then
- export HOME=/home/USER
- sleep 5
- start-stop-daemon --start --chuid USER--exec /usr/bin/mocp -- -S
- /usr/bin/mocp --volume 100 --play
- sleep 5
- /usr/bin/mocp --on shuffle
- /usr/bin/mocp --on autonext
- /usr/bin/mocp --on repeat
- echo "Starting MOCP..."
- else
- echo "MOCP Already Running..."
- fi
- ;;
- stop)
- start-stop-daemon --stop --exec /usr/bin/mocp -- -x
- ;;
- restart)
- start-stop-daemon --stop --exec /usr/bin/mocp -- -x
- sleep 1
- if ! pidof -o %PPID mocp > /dev/null; then
- export HOME=/home/USER
- sleep 5
- start-stop-daemon --start --chuid USER--exec /usr/bin/mocp -- -S
- /usr/bin/mocp --volume 100 --play
- sleep 5
- /usr/bin/mocp --on shuffle
- /usr/bin/mocp --on autonext
- /usr/bin/mocp --on repeat
- echo "Restarting MOCP..."
- else
- echo "MOCP Already Running, Restart Failed"
- fi
- ;;
- status)
- if pidof -o %PPID mocp > /dev/null; then
- echo "Running"
- exit 0
- else
- echo "Not running"
- exit 1
- fi
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|status}"
- exit 1
Advertisement
Comments
-
- You will need to add this two lines at the end of the script
- ;;
- esac
- and of course chmod +x mocp
-
- I forgot to mention that the line
- start-stop-daemon --start --chuid USER--exec /usr/bin/mocp -- -S
- must be
- start-stop-daemon --start --chuid USER --exec /usr/bin/mocp -- -S
- and you will need to change USER for whatever the name of the user you want to use and to save/play playlists
- Regards
Add Comment
Please, Sign In to add comment
Advertisement