answersLogoWhite

0

Something like this:

#!/bin/sh

### BEGIN INIT INFO

# Provides: mpd

# Required-Start: $local_fs $remote_fs

# Required-Stop: $local_fs $remote_fs

# Should-Start: autofs $network $named alsa-utils pulseaudio

# Should-Stop: autofs $network $named alsa-utils pulseaudio

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Music Player Daemon

# Description: Start the Music Player Daemon (MPD) service

# for network access to the local audio queue.

### END INIT INFO

. /lib/lsb/init-functions

PATH=/sbin:/bin:/usr/sbin:/usr/bin

NAME=mpd

DESC="Music Player Daemon"

DAEMON=/usr/bin/mpd

MPDCONF=/etc/mpd.conf

START_MPD=true

# Exit if the package is not installed

[ -x "$DAEMON" ] exit 0

# Read configuration variable file if it is present

[ -r /etc/default/$NAME ] && . /etc/default/$NAME

if [ -n "$MPD_DEBUG" ]; then

set -x

MPD_OPTS=--verbose

fi

DBFILE=$(sed -n 's/^[[:space:]]*db_file[[:space:]]*"\?\([^"]*\)"\?/\1/p' $MPDCONF)

PIDFILE=$(sed -n 's/^[[:space:]]*pid_file[[:space:]]*"\?\([^"]*\)"\?/\1/p' $MPDCONF)

mpd_start () {

if [ "$START_MPD" != "true" ]; then

log_action_msg "Not starting MPD: disabled by /etc/default/$NAME".

exit 0

fi

log_daemon_msg "Starting $DESC" "$NAME"

if [ -z "$PIDFILE" -o -z "$DBFILE" ]; then

log_failure_msg \

"$MPDCONF must have db_file and pid_file set; cannot start daemon."

exit 1

fi

PIDDIR=$(dirname "$PIDFILE")

if [ ! -d "$PIDDIR" ]; then

mkdir -m 0755 $PIDDIR

if dpkg-statoverride --list --quiet /run/mpd > /dev/null; then

# if dpkg-statoverride is used update it with permissions there

dpkg-statoverride --force --quiet --update --add $( dpkg-statoverride --list --quiet /run/mpd ) 2> /dev/null

else

# use defaults

chown mpd:audio $PIDDIR

fi

fi

start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" \

--exec "$DAEMON" -- $MPD_OPTS "$MPDCONF"

log_end_msg $?

}

mpd_stop () {

if [ -z "$PIDFILE" ]; then

log_failure_msg \

"$MPDCONF must have pid_file set; cannot stop daemon."

exit 1

fi

log_daemon_msg "Stopping $DESC" "$NAME"

start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile "$PIDFILE" \

--exec $DAEMON

log_end_msg $?

}

# note to self: don't call the non-standard args for this in

# {post,pre}{inst,rm} scripts since users are not forced to upgrade

# /etc/init.d/mpd when mpd is updated

case "$1" in

start)

mpd_start

;;

stop)

mpd_stop

;;

status)

status_of_proc -p $PIDFILE $DAEMON $NAME

;;

restart|force-reload)

mpd_stop

mpd_start

;;

force-start)

mpd_start

;;

force-restart)

mpd_stop

mpd_start

;;

force-reload)

mpd_stop

mpd_start

;;

*)

echo "Usage: $0 {start|stop|restart|force-reload}"

exit 2

;;

esac

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Could you tell me how to write a script that verify that I am the root user in Linux?

You don't need a shell script for this; just use the 'id' command look at the uid, which for root is 0.


What are Linux semaphores?

Search Google with: "Linux semaphores" and have a look through the websites on the subject.


The script of film Troy?

Apparently there is a draft of the script on the Internet Movie Script Database. Look at the link, below.


What does a Shell Bell look like?

a shell


What is the Linux Documantation Project?

The answer is in the question. It documents the Linux computer operation system. Take a look at tldp.org


Where can you look for the script bad girl?

the internet


How do you examine a tortoise when it withdraw its head into its shell?

look in the shell


How does a Linux computer look like?

Linux doesn't look like anything. It is a kernel upon which complete operating systems can be built. Each Linux operating system, known as a "distro", has its own unique appearance. Some of them are pretty spectacular and make mainstream OSes look like muck. Some look like gibberish spewed out of a teletype machine. Linux has this way of being just what you want, or, sometimes, almost-but-not-quite what you want. If you're not paying attention, it can even manifest itself as what you deserve. Linux is mutable.


What is the script for a skateboard on roblox?

Put a skateboard in your place when your building or in ROBLOX Studio and then select the skateboard and thne look for the script.


What does a shooting script look like?

outline with notes and narration


Where can you find a online script of honk the musical?

there are various websites. look up 'honk script', or ask, if youre in the play, the director.


Why does text look funny in Linux?

Text probably looks a little different from what you are used to in Linux because Linux only uses freely licensed fonts. This means no Arial, no Times New Roman, no Tacoma, etc...