|
|
vim /etc/init.d/rc.local
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
log_end_msg $?
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
(该文件结束啦~)
ls -l /etc/rc.local
-rwxr-xr-x 1 root root 385 2007-07-18 21:10 /etc/rc.local
问题是:我在/etc/rc.local写的命令开机时并没有执行
vim/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sudo /sbin/ifconfig eth1 hw ether 00:00:E0:80:30:9A
sudo /sbin/ifconfig eth1 up
exit 0 |
|