1./etc/rc.local is actually a soft connection of/etc/rc.d/rc.local, then:
# cat/etc/rc.d/rc.local
#! /bin/sh
/usr/bin/offlineimap &
/usr/bin/echo "ABDC" >/root/test-lili &
--------
chmod +x/etc/rc.d/rc.local ln-s/etc/rc.d/rc.local/etc/rc.local 2. Restart the machine to see if there is more than one file/root under Test-lili, and Offlineimap is already running, This means that our boot script is already running.
***
Note:
When writing a/etc/rc.d/rc.local file,
Commands are best used with full path names and can be written in the background, which speeds up the boot speed.
--------------------------------------------
Add sudo user
# echo "Lijun all= (All) all" >>/etc/sudoers.d/lijun
------------------
REF:
http://blog.csdn.net/lingfong_cool/article/details/8861020
=============================================================
Method Two:
CD/ETC/INIT.D
VI youshell.sh #将youshell. SH modified to your own foot name
Write your own script and save the exit. When writing a script, please add the following comments first
#add for Chkconfig
#chkconfig: 2345
#description: The description of the shell #关于脚本的简短描述
# Processname:servicename #第一个进程名, the rear settings will be used when the boot
Description
2345 refers to the running level of the script, that is, in 2345 of the 4 modes can be run, 234 are text interface, 5 is the graphical interface x
70 refers to the future startup sequence number of the script, if the start sequence number of other programs is smaller than 70 (such as 44, 45), the script needs to wait until these programs are started before starting.
30 refers to the stop order number of the script when the system shuts down.
----
e.g:
Cat youshell.sh
#! /bin/sh
#add for chkconfig
#chkconfig: 2345
#description: The description of the Shell
# Processname:servicename_li
/usr/bin/offlineimap &
----
Add executable permissions to the script:
chmod +x youshell.sh
Chkconfig--level 2345 youshell.sh on
-----------
Ok! success!