You are not logged in.

#1 2008-01-03 15:37:25

print
Member
Registered: 2007-02-27
Posts: 174

my collectd init script

collectd (http://collectd.org) rocks.  Here's a init script for all you Archers:

$ cat /etc/rc.d/collectd

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

COLLECTD=/sbin/collectd
CONF=/etc/collectd.conf
PID=`pidof -o %PPID /sbin/collectd`

case "$1" in
  start)
    stat_busy "Starting collectd Daemon"
    [ -z "$PID" ] && $COLLECTD
    if [ $? -gt 0 ]; then
      stat_fail
    else
      echo $PID > /var/run/collectd.pid
      add_daemon collectd
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping collectd Daemon"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm /var/run/collectd.pid
      rm_daemon collectd
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 10
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

% whereis whatis whence which whoami whois who

Offline

Board footer

Powered by FluxBB