#!/bin/bash PROGRAM="/usr/sbin/wicd" RUNLEVEL=3 PIDFILE="/var/run/wicd/wicd.pid" NEEDS="+local_fs smgl-messagebus" PROVIDES=network . /etc/init.d/smgl_init start() { echo "Starting wicd..." mkdir -p $(dirname $PIDFILE) # make sure there is actually a process there... if [ -f $PIDFILE ]; then echo "Found $PIDFILE doing extra checks..." if [ "$(pgrep -f 'wicd-daemon')" != $(cat $PIDFILE) ]; then print_status warning "$PIDFILE exists, but wicd is not running under this PID" echo "Attempting cleanup and new startup..." rm -f $PIDFILE else $SET_WCOL print_status warning running return 0 fi fi # don't use loadproc here, as that fails if some user is running # a session bus $PROGRAM $ARGS evaluate_retval } stop() { echo "Stopping wicd..." if [ -e $PIDFILE ]; then kill $(cat $PIDFILE) 2>/dev/null rm -f $PIDFILE 2>/dev/null evaluate_retval else $SET_WCOL print_status warning not_running fi } .