The steps for Ubuntu to create a startup script are as follows:1 Copy your startup script to the/ETC/INIT.D directoryThe following assumes that your script file name is test.sh. The steps for Ubuntu to create a startup script are as follows:
1 Copy your startup script to the/ETC/INIT.D directory
The following assumes that your script file name is test.sh.
2 Set permissions on script files
$ sudo chmod 755/etc/init.d/test.sh
3 Execute the following command to place the script in the startup script:
$ cd/etc/init.d
$ sudo update-rc.d test.sh defaults 95
Note: The number 95 is the sequence number of the script to start, according to their own needs to modify accordingly. You know how this number works when you have multiple startup scripts, and there are dependent dependencies that start between them. The output information for this command is referenced as follows:
Update-rc.d:warning:/etc/init.d/test Missing LSB information
Update-rc.d:see Adding system startup For/etc/init.d/test ...
/etc/rc0.d/k95test->. /init.d/test
/etc/rc1.d/k95test->. /init.d/test
/etc/rc6.d/k95test->. /init.d/test
/etc/rc2.d/s95test->. /init.d/test
/etc/rc3.d/s95test->. /init.d/test
/etc/rc4.d/s95test->. /init.d/test
/etc/rc5.d/s95test->. /init.d/test
To uninstall the startup script:
$ cd/etc/init.d
$ sudo update-rc.d-f test remove
The information for the output of the command is referenced as follows:
Removing any system startup links for/etc/init.d/test ...
/etc/rc0.d/k95test
/etc/rc1.d/k95test
/etc/rc2.d/s95test
/etc/rc3.d/s95test
/etc/rc4.d/s95test
/etc/rc5.d/s95test
/etc/rc6.d/k95test
2 Set permissions on script files$ sudo chmod 755/etc/init.d/test
3 Execute the following command to place the script in the startup script:$ CD/ETC/INIT.D $ sudo update-rc.d test Defaults 95 Note: Where the number 95 is the sequence number of the script to start, modify it accordingly according to your own needs. You know how this number works when you have multiple startup scripts, and there are dependent dependencies that start between them. The output information for this command is referenced as follows:
Update-rc.d:warning:/etc/init.d/test Missing LSB information
Update-rc.d:see Adding system startup For/etc/init.d/test ...
/etc/rc0.d/k95test->. /init.d/test
/etc/rc1.d/k95test->. /init.d/test
/etc/rc6.d/k95test->. /init.d/test
/etc/rc2.d/s95test->. /init.d/test
/etc/rc3.d/s95test->. /init.d/test
/etc/rc4.d/s95test->. /init.d/test
/etc/rc5.d/s95test->. /init.d/test
to uninstall the startup script:$ CD/ETC/INIT.D $ sudo update-rc.d-f Test remove command output information reference is as follows:
Removing any system startup links for/etc/init.d/test ...
/etc/rc0.d/k95test
/etc/rc1.d/k95test
/etc/rc2.d/s95test
/etc/rc3.d/s95test
/etc/rc4.d/s95test
/etc/rc5.d/s95test
/etc/rc6.d/k95test
Reference: http://rongjih.blog.163.com/blog/static/33574461201111504843245/