Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 233605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:06:59+00:00 2026-05-11T20:06:59+00:00

I need an application to be running in the background on my web server,

  • 0

I need an application to be running in the background on my web server, but I need to be able to start/stop the application with root privileges.

In order to do this, I want to have a service running that has root privileges, so that it can kill the application, and start it up again if need be.

Finally, I need to be able to send the start and kill commands to the service via Apache/PHP, so that it can be indirectly controlled through the web.

How do I create a Linux service?
How do I communicate with a Linux service in this manner?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:06:59+00:00Added an answer on May 11, 2026 at 8:06 pm

    Use the exec command in your PHP script to call shell files. The shell files can be setup with the “setuser” bit so it will run as its owner (instead of running with the web server’s permissions).

    Of course, you’ll need to be very careful–lots of testing, monitoring, etc.

    Finally, think about the service running as a dedicated user, not as root. Eg like apache and most other well done services do.

    Added: Re: running a service in Linux. Depends on your flavor of Linux. If you want to be sure that your app service will be automatically re-started if it fails, plus logging, checkout Runit:

    https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/opensource/?p=202

    http://smarden.org/runit

    Added: Instead of setuid bit, I think Frank’s suggestion (in comment) of using sudo system is better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my web application running on LAMP, I need to be able to deploy
I have an application running on multiple IIS servers that need to parse a
I have multiple threads (C# application running on IIS) running that all need to
I need to impersonate myself as a domain user in a ASP.NET application running
I need to detect whether my application is running within a virtualized OS instance
I need to know what internet connection is available when my application is running.
I am running a Tomcat application, and I need to display some time values.
I have a CakePHP 1.2 application. I'm running into the case where I need
I need my application to behave differently depending on whether Vista UAC is enabled
I need my .net application to use the .html extension instead of .aspx I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.