Use nohup when starting the service

Source: Internet
Author: User

This is not always a problem, but when I use the boost: asio service to install it as a Linux service, I use newlisp (exec "service data_service start ") when I started it, I found that newlisp would be suspended. I have mentioned this question in the newlisp community until I forget that no one answered this question. :(

However, when I encountered this problem again today, I decided to solve it myself. First, I guess there was a problem with the service Startup Script.

It turns out that there is a row in/etc/init. d/data-service.

./Data_service./config. xml &


The data_service script file runs normally on the terminal.

But http://stackoverflow.com/questions/4797050/how-to-run-process-as-background-and-never-die after reading this post

Remember, I used nohup before and tried it.

nohup ./data_service_d ./config.xml > /dev/null 2>&1 &

Okay. The problem is solved.

Here:

nohup means: Do not terminate this process even when the stty is cut off.> /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output).2>&1 means: stderr also goes to the stdout (which is already redirected to /dev/null).& at the end means: run this command as a background task.


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.