Linux centos mono C # configure auto-start upon startup

Source: Internet
Author: User

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.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.