[aur-general] Pommed initscript

BaSh bash.lnx at gmail.com
Fri May 2 07:48:02 EDT 2008


Hi,
2008/5/2 Jordi Cerdan <jcerdan at tecob.com>:
>  I'm the maintainer of pommed in AUR and I would like to adapt the init
>  daemon script to the Archlinux standard, as user royrocks suggested me.
this is the rc-script.proto:

#!/bin/bash

daemon_name=DAEMON_NAME

. /etc/rc.d/functions

. /etc/conf.d/$daemon_name.conf

. /etc/rc.conf

get_pid() {
	pidof $daemon_name
}

case "$1" in
  start)
    stat_busy "Starting $daemon_name daemon"

    PID=`get_pid`
    if [ -z "$PID" ]; then
      [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
      # RUN
      $daemon_name
      #
      if [ $? -gt 0 ]; then
        stat_fail
        exit 1
      else
        echo `get_pid` > /var/run/$daemon_name.pid
        add_daemon $daemon_name
        stat_done
      fi
    else
      stat_fail
      exit 1
    fi
    ;;

  stop)
    stat_busy "Stopping $daemon_name daemon"
    PID=`get_pid`
    # KILL
    [ ! -z "$PID" ] && kill $PID &> /dev/null
    #
    if [ $? -gt 0 ]; then
      stat_fail
      exit 1
    else
      rm -f /var/run/$daemon_name.pid &> /dev/null
      rm_daemon $daemon_name
      stat_done
    fi
    ;;

  restart)
    $0 stop
    sleep 3
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0




Regards,
Andrea


-- 
Andrea `BaSh` Scarpino
Arch Linux Trusted User
Linux User: #430842




More information about the aur-general mailing list