Ida server daemon Tutorial




The AVAP-Daemon is the server daemon of Ida. First download the daemon. You can choose between a debian package, a bz2-compressed or a gz-compressed tar archive. To extract the tar.bz2 archive type

$ tar xvjf avapd-0.0.1.tar.bz2

or for the tar.gz archive

$ tar xvzf avapd-0.0.1.tar.gz

Before you can compile the server, check that your version of gcc is 3.0 or higher! Then enter the new directory and run these commands to compile the server

$ cd avapd-0.0.1
$ ./configure && make

For the installation you need root privileges!

$ su
Password:
# make install

If you are running a Debian system and don't want to compile the server yourself, you can download the debian package and install it (you have to be root).

# dpkg -i avapd_0.0.1-1_i386.deb

Now the server is installed and executable with the command "avapd". When you want to start the server, ensure that postgres is running and don't forget to start the mDNSResponder if you want to connect with iTunes to the server! To get a list of options use

$ avapd --help

It is recommended to start the server in backround and to define a logfile.

$ avapd -b -l LOGFILE.log

It's also usefull to start the server at boot time. So you need a startscript and rc-links on it. Enter the directory where the startscripts are and create a new file called "avapd". Use your favorite editor to do this (vi, vim, nano, ...).

# cd /etc/init.d
# vi avapd

Now copy in the following script.

 
#! /bin/sh
#
#       Written by Alexander Bauer 
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON="avapd -b -v -s"
#RESPONDER="/path/to/mDNSResponder-66.3/mDNSPosix/build/mDNSResponderPosix -p 3689 -t _daap._tcp. -n `hostname`&"
NAME=avapd
DESC="Ida server daemon"


case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        su ida -c "$DAEMON"
#        su ida -c "$RESPONDER"
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME "
#        killall mDNSResponderPosix
        killall avapd
        echo "."
        ;;
  restart|force-reload)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
        echo -n "Restarting $DESC: $NAME"
#        killall mDNSResponderPosix
        killall avapd
        sleep 1
        su ida -c "$DAEMON"
#        su ida -c "$RESPONDER"
        echo "."
        ;;
  *)
        N=/etc/init.d/$NAME
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

If you don't like to use syslog remove the "-s" option of avapd and add "-l YOUR_LOGFILE" instead. Of course you can add any options you want... And if you want the script to start the mDNSResponder for iTunes you must remove the "#" at the beginning of the following lines!

 #RESPONDER="/path/to/mDNSResponder-66.3/mDNSPosix/build/mDNSResponderPosix -p 3689 -t _daap._tcp. -n `hostname`&"
 #        su ida -c "$RESPONDER"
 #        killall mDNSResponderPosix
 #        killall mDNSResponderPosix
 #        su ida -c "$RESPONDER"

In the first of these lines you also have to correct the path of the Responder.

Finaly you can run the following commands to create the links.

 # ln -s /etc/init.d/avapd /etc/rc0.d/K10avapd
 # ln -s /etc/init.d/avapd /etc/rc1.d/K10avapd
 # ln -s /etc/init.d/avapd /etc/rc2.d/S50avapd
 # ln -s /etc/init.d/avapd /etc/rc3.d/S50avapd
 # ln -s /etc/init.d/avapd /etc/rc4.d/S50avapd
 # ln -s /etc/init.d/avapd /etc/rc5.d/S50avapd
 # ln -s /etc/init.d/avapd /etc/rc6.d/K10avapd

Now the server is installed and starts up at boot time.



back