Rewritten init.d script for CentOS 5.4

This topic contains 1 reply, has 1 voice, and was last updated by  Jean-Luke 7 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3017

    Jean-Luke
    Participant

    Hi everybody – my first post in here.

    I tried to install from the RPM package in EPEL on my CentOS 5.4 rig, but could not get it to work. I reverted to compiling from the source, and I’m up and running. I notice the init.d script for RedHat was not working as it should. It even had some comments in the “stop” section about being broken.

    Anyhow, I’ve re-worked the script and it is now working on my rig, so I assume it will work on RHEL5 too. It stops, starts, restarts and removes the PID file when it stops (one if the broken things in the code as packaged). I’d like to contribute the script back to the project, if possible. I’ve never actually contributed to a FOSS project before. How do I go about doing this?

    The script is attached for all to see. No warranties – use it as you see fit – at your own risk.

    #18891

    Jean-Luke
    Participant

    Oops… the script:

    #!/bin/bash
    #
    # chkconfig: 2345 85 15
    # description: mt-daapd is a multi-threaded DAAP server for iTunes
    # processname: mt-daapd
    # pidfile: /var/run/mt-daapd

    #

    # source function library
    . /etc/init.d/functions
    [ -e /etc/daapd.conf ]

    RETVAL=0
    pidfile="/var/run/mt-daapd.pid"
    exec="/usr/local/sbin/mt-daapd"
    lockfile="/var/lock/subsys/mt-daapd"

    start() {
    echo -n $"Starting DAAP server: "
    daemon --pidfile $pidfile $exec
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch $lockfile
    echo
    }

    stop() {
    echo -n $"Shutting down DAAP server: "
    killproc -p $pidfile $exec
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f $lockfile
    echo
    }

    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart|reload)
    stop
    sleep 1
    start
    RETVAL=$?
    ;;
    status)
    status -p $pidfile $exec
    RETVAL=$?
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
    exit 1
    esac

    exit $RETVAL

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Register here