Write a script named: autostart.sh, placed in the/etc/init.d/directory, give permission chmod +x/etc/init.d/autostart.sh
The code is as follows
#!/bin/sh#chkconfig:2345 #description: Autostart server Daemon#shell script Body Custom # ..... start ..... stop, ..... ..... ..... restart .... ....
In this case, the service command can be used to see if CHKCONFG can be used
Enter/etc/rc.d/init.d/chkconfig--list autostart//If the service Autostart supports ....---add autostart ')
Perform
Chkconfig autostart onchkconfig--list autostart
Return
Autostart 0:off 1:off 2:on 3:on 4:on 5:on 6:off
You can also turn off
Chkconfig autostart off
The different run level definitions are as follows: # 0-Stop (do not set Initdefault to 0) # 1-Single user mode # s init s = init # 2-multiuser, no nfs# 3-full multiuser mode (standard run level) # 4 -No use for # 5-x11 multi-user graphics mode (xwindow) # 6-reboot (never set the Initdefault to 6)
Then init.6 restart the test
Modify Apache to implement the same self-priming
CD/ETC/INIT.D//Enter this directory CP/USR/LOCAL/APACHE/BIN/APACHECTL.///Copy files to current directory MV Apachectl httpd Find Apachectl, give it a new name Httpdvim httpd//Modify the file, put the following two lines of code head #!/bin/sh below
#chkconfig: 2345 #description: Httpd Server daemon
Service httpd Start
Service httpd STOP: Test if the impact is accessed and then test chkconfig
Chkconfig http on
Chkconfig--list httpd .....
Complete
Add custom scripts under Linux to boot from boot, standard RPM, example: Set Apache self-boot