I’ve been playing around with bash scripting quite a bit recently in relation to my current job.
Came up with one that’s really useful (imho) around
# mass set all services known to chkconfig to be `on` or `off` at given level
# written by warren myers - email@example.com
# 28 sep 2009
echo " $0 <level> [on|off]"
# list all services, just the name, skip blank lines, do in order
SERVICES=`chkconfig --list | cut -f 1 | grep -v ^$ | grep -v ':' | sort`
for SERVICE in $SERVICES
chkconfig --level $1 $SERVICE $2
echo "$SERVICE has been altered for $1 to state $2"
Yes – there’s an evil you could perform:
for CS in `chkconfig --list | cut -f 1 | grep -v ^$ | grep -v ':'`
chkconfig --level 12345 $CS off
So, if you wanted to stop all services from coming on at startup, you could – and not know you did it until you rebooted.