dwm
Verified User
This script works like chkconfig, but uses update-rc.d in the background for adding and removing system services on a Debian system. I hope some users like this! 

Code:
#!/bin/sh
# Author: Tim Boormans, Direct Web Solutions
# Email: info [at] directwebsolutions.nl
# Description: This script works like chkconfig, but uses update-rc.d in
# the background for adding and removing system services on a Debian system.
#
# Examples:
# chkconfig --add name_of_the_service
# chkconfig --del name_of_the_service
#
# Not working: chkconfig 2345 80 20
# For using this on your own system add a file called 'chkconfig' with
# this content in the /sbin/ folder on your harddrive and
# run once this command: chmod +x /sbin/chkconfig
# Variables
SERVICE=$2
# Functions
add() {
if [[ `ls -a /etc/init.d/ | grep -e "^$SERVICE$"` ]]
then
echo -n "Adding service: $SERVICE"
echo
/usr/sbin/update-rc.d $SERVICE defaults
else
echo -n "File /etc/init.d/$SERVICE not found."
echo
fi
}
delete() {
if [[ `ls -a /etc/init.d/ | grep -e "^$SERVICE$"` ]]
then
echo -n "Removing service: $SERVICE"
echo
/usr/sbin/update-rc.d -f $SERVICE remove
else
echo -n "Error removing: service does not exist."
echo
fi
}
# Exactly two parameters required
if [[ $# != 2 ]]
then
echo -n "Usage: $0 {--add|--del} name_of_the_service"
echo
exit 1
fi
# Check the command line for actions
case "$1" in
"--add")
add
;;
"--del")
delete
;;
*)
echo -n "Usage: $0 {--add|--del} name_of_the_service"
echo
exit 1
esac
exit 0