Using shell-fm as a daemon

what's great with shell-fm, in my opinion, is the ability to run as a daemon. Here is my configuration of shell-fm as a daemon in a debian server (various commands are debian specific):

setting up the lastfm (system) user:

# adduser --system --home /var/lib/lastfm --shell /bin/false lastfm
... adding system user lastfm
# grep lastfm /etc/passwd
lastfm:x:112:65534::/var/lib/lastfm:/bin/false

configuring shell-fm:

# cat /var/lib/lastfm/.shell-fm/shell-fm.rc
username=ME
password=MYPASS
np-file=currentsong
np-file-format=%a: %t
default-radio=lastfm://user/ME/neighbours
bind=192.168.0.1

setting up an init script for lastfm:

# cat /etc/init.d/lastfm
#!/bin/sh
#
PREFIX=/usr
case "$1" in
   (start)
      echo "Starting lastfm player (shell-fm)"
      start-stop-daemon -c lastfm -d /var/lib/lastfm --quiet --start --exec $PREFIX/bin/shell-fm -- -d
      ;;
   (stop)
      echo "Stopping lastfm player (shell-fm)"
      start-stop-daemon --stop --quiet --exec $PREFIX/bin/shell-fm >/dev/null
      ;;
   (restart)
      $0 stop
      $0 start
      ;;
   (*)
      echo $0 "start|stop|restart"
      exit 1
      ;;
esac
exit 0

making shell-fm work on system startup:

# update-rc.d lastfm defaults
[...]
# /etc/init.d/lastfm start
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial 3.0 License