Skip to content

Instantly share code, notes, and snippets.

@discreet
Created September 29, 2014 14:32
Show Gist options
  • Save discreet/2b4bc1717b9e643e478a to your computer and use it in GitHub Desktop.
Save discreet/2b4bc1717b9e643e478a to your computer and use it in GitHub Desktop.
Remove udev rules
#!bin/bash
#
# chkconfig: 35 20 30
# description: A problem exists when cloining a virtual machine
# that is currently up when using vmware. The problem
# this script solves is to remove the udev rule for
# networking.
# source function library
. /etc/rc.d/init.d/functions
udev_net_rule='/etc/udev/rules.d/70-persistent-net.rules'
lockfile='/var/lock/subsys/removeudev'
mystart()
{
if [ -f $udev_net_rule ]; then
/bin/echo "The file $udev_net_rule exits"
/bin/touch $lockfile
else
/bin/echo "The file $udev_net_rule does not exist"
fi
}
mystop()
{
if [ -f $udev_net_rule ]; then
/bin/echo "Removing $udev_net_rule" > /tmp/test
/bin/rm $udev_net_rule
/bin/rm $lockfile
else
echo "The file $udev_net_rule does not exist" > /tmp/test
fi
}
case "$1" in
start) mystart;;
stop) mystop;;
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment