Linux在启动时,会自动执行/etc/rc.d目录下的初始化程序,因此我们可以把启动任务放到该目录下:
1、因为其中的rc.local是在完成所有初始化之后执行,因此可以把启动脚本写到里面; 2、用root账号登陆Linux,vi /etc/rc.d/rc.local编辑文件,在最后加入需要执行的脚本程序: