in/etc/rc. d/init. create a test. sh script file, enter the following shell Code
#! /Bin/bash
# chkconfig: 2345 99 30
explanation:
2345 indicates the system startup level, there are many blogs in this regard, so I will not elaborate here
99 indicates the order of startup
30 indicates the order of shutdown
# description: mono hellomono.exe
retval = 0
Start () {
explanation: the following two statements are mono environment variables, because I don't know how to let the system read the configuration file before the service starts, I Will uninstall it. If anyone knows, let me know in the form of a comment
export Path = $ path: /opt/MONO/bin
export LD_LIBRARY_PATH =/opt/MONO/lib
full path of the mono Program , the program cannot have a graphical interface. I do not know how to automatically start the graphic interface program
}< br> stop () {
stop the program script
}
# See how we were called.
Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Restart)
Stop
Start
;;
Esac
Exit $ retval
The shell script must be an executable file.
Chmod + X test. Sh
Add to self-starting service
Chkconfig -- add test. Sh
Check whether the service is successfully added.
Chkconfig -- List Test. Sh
The above are all the processes for creating mono C # self-starting in my work. I hope it will be helpful to you. If there are any errors, please let us know, or you have a better way to communicate with each other.