SliTaz SliTaz Forum

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

Guest
Invité

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
Invité

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
Inscrit(e): 2011-03-28
Messages: 657

Re: mpd init script

Hi,

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

Thanks,

-pascal

Hors ligne

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

fork
Membre
Inscrit(e): 2011-11-09
Messages: 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.

Hors ligne

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

Trixar_za
Administrator
Inscrit(e): 2011-03-29
Messages: 1 506

Re: mpd init script

Which is logical and only requires using chmod +x

Hors ligne

Utilisateurs enregistrés en ligne dans ce sujet: 0, Invité(s): 1
[Bot] ClaudeBot

Pied de page

Propulsé par FluxBB
Modifié par Visman Traduit par N-Studio18

[ Généré en 0.017 secondes, 7 requêtes exécutées - Utilisation de la mémoire: 1.53 MiO (Pic : 1.77 MiO) ]