3 # description: collectd startup script
5 # March 2010, Aurelien Reynaud <collectd@wattapower.net>
8 # Some plugins need libs in non-standard paths
11 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/ssl/lib"
12 export LD_LIBRARY_PATH
21 COLLECTD_BIN=/opt/freeware/sbin/collectd
22 PIDFILE=/opt/freeware/var/run/collectd.pid
24 # Check for missing binaries (stale symlinks should not happen)
25 if [ ! -x $COLLECTD_BIN ]; then
26 echo "$COLLECTD_BIN not installed"
27 [ "$1" = "stop" ] && exit 0
31 # Check for existence of needed config file and read it
32 COLLECTD_CONFIG=/opt/freeware/etc/collectd.conf
33 if [ ! -r $COLLECTD_CONFIG ]; then
34 echo "$COLLECTD_CONFIG not existing"
35 [ "$1" = "stop" ] && exit 0
41 if [ -r $PIDFILE ]; then
42 echo "collectd daemon is already running with PID `cat $PIDFILE`."
45 echo "Starting collectd..."
51 echo "Shutting down collectd daemon... "
53 if [ -r $PIDFILE ]; then
56 while ps -p $pid >/dev/null; do
63 if [ -r $PIDFILE ]; then
64 echo "collectd daemon is running with PID `cat $PIDFILE`."
66 echo "collectd daemon is not running."
70 ## Stop the service and regardless of whether it was
71 ## running or not, start it again.
76 echo "Usage: $0 {start|stop|status|restart}"