Skip to content

Instantly share code, notes, and snippets.

@cjohnson496
Created April 25, 2017 21:35
Show Gist options
  • Save cjohnson496/9dd2b3fa8be80ce1050491ed3552e667 to your computer and use it in GitHub Desktop.
Save cjohnson496/9dd2b3fa8be80ce1050491ed3552e667 to your computer and use it in GitHub Desktop.
Function to stop services, useful when chrooting to tmpfs for / filesystem resize, etc.
stop_services() {
echo "Stopping services, it's probably safe to ignore any errors..."
for service in `chkconfig -list | awk '{print$1}' | grep -v ':\|ssh\syslog\|network\|mdadm\|dbus\|cron\|ccproc\|dnsmasq\|kbd'`; do
chkconfig $service off
/etc/init.d/$service stop
echo -n "Disabling and Stoping $service"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment