SliTaz SliTaz Forum

You are not logged in.

#1 2011-07-25 20:26:37

Guest
Guest

mpd init script

Hi,

Here is an init script for mpd (music player daemon) in order to start/stop it in boot phase.

Just need to put it in /etc/init.d

and add "mpd" in the RUN_DAEMONS of /etc/rcS.conf

hope it will be useful,

#2 2011-07-25 20:29:42

Guest
Guest

Re: mpd init script

#!/bin/sh

# /etc/init.d/mpd: Start, stop and restart mpd deamon on SliTaz, at boot

# time or with the command line.

#

# To start daemon at boot time, just put the right name in the $RUN_DAEMONS

# variable of /etc/rcS.conf and configure options with /etc/mpd.conf.

#

. /etc/init.d/rc.functions

NAME=mpd

DESC="Music Player Daemon"

DAEMON=/usr/sbin/mpd

OPTION="/etc/mpd.conf"

case "$1" in

  start)

    echo -n "Starting $DESC: $NAME... "

    $DAEMON $OPTION &> /dev/null

    status

    ;;

  stop)

    echo -n "Stopping $DESC: $NAME... "

    $DAEMON --kill &> /dev/null

    status

    ;;

  restart)

    echo -n "Restarting $DESC: $NAME... "

    $DAEMON --kill &> /dev/null

    sleep 2

    $DAEMON $OPTION &> /dev/null

    status

    ;;

  *)

    echo ""

    echo -e "33[1mUsage:33[0m /etc/init.d/[c]basename $0[/c] [start|stop|restart]"

    echo ""

    exit 1

    ;;

esac

exit 0

#3 2011-07-26 09:52:56

bellard
Administrator
Registered: 2011-03-28
Posts: 657

Re: mpd init script

Hi,

Pushed: http://hg.slitaz.org/wok/rev/6b69e208e751

Thanks,

-pascal

Offline

#4 2011-12-25 19:31:27

fork
Member
Registered: 2011-11-09
Posts: 28

Re: mpd init script

Not sure how this script could not have been included as part of the MPD package, but it works.  I had to recreate the mpd database on every boot without it.  If you're doing this for the first time like I was, note that you have to set the file permissions to include Execute.

Offline

#5 2011-12-25 22:26:36

Trixar_za
Administrator
Registered: 2011-03-29
Posts: 1,506

Re: mpd init script

Which is logical and only requires using chmod +x

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.017 seconds, 7 queries executed - Memory usage: 1.55 MiB (Peak: 1.78 MiB) ]