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

  • SEARCH
  • Home
  • 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 7916345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:46:16+00:00 2026-06-03T14:46:16+00:00

Below is a upstart script for redis. How to I create a pid so

  • 0

Below is a upstart script for redis. How to I create a pid so I use monit for monitoring?

#!upstart
description "Redis Server"

env USER=redis

start on startup
stop on shutdown

respawn

exec sudo -u $USER sh -c "/usr/local/bin/redis-server /etc/redis/redis.conf 2>&1 >> /var/log/redis/redis.log"
  • 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-06-03T14:46:19+00:00Added an answer on June 3, 2026 at 2:46 pm

    If start-stop-daemon is available on your machine, I would highly recommend using it to launch your process. start-stop-daemon will handle launching the process as an unprivileged user without forking from sudo or su (recommended in the upstart cookbook) AND it also has built in support for pid file management. Eg:

    /etc/init/app_name.conf

    #!upstart
    description "Redis Server"
    
    env USER=redis
    
    start on startup
    stop on shutdown
    
    respawn
    
    exec start-stop-daemon --start --make-pidfile --pidfile /var/run/app_name.pid --chuid $USER --exec /usr/local/bin/redis-server /etc/redis/redis.conf >> /var/log/redis/redis.log 2>&1
    

    Alternatively you could manually manage the pid file by using the post-start script stanza to create it and post-stop script stanza to delete it. Eg:

    /etc/init/app_name.conf

    #!upstart
    description "Redis Server"
    
    env USER=redis
    
    start on startup
    stop on shutdown
    
    respawn
    
    exec sudo -u $USER sh -c "/usr/local/bin/redis-server /etc/redis/redis.conf 2>&1 >> /var/log/redis/redis.log"
    
    post-start script
        PID=`status app_name | egrep -oi '([0-9]+)$' | head -n1`
        echo $PID > /var/run/app_name.pid
    end script
    
    post-stop script
        rm -f /var/run/app_name.pid
    end script
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below script will downlaod the facebook sdk to generate the code to create the
Below is an image from a site that hase user photo's, they link to
Below I have a jquery code which includes a textbox where the user can
Below is my code for Linux. I am implementing a client/server application and below
Below is the code I use in Chrome extension which gets a url from
below is a java script function and the html for the clicked item that
below I have a query that will get the most common user agents for
Below is my stored procedure. I want use stored procedure select all row of
Below is my code. For some reason, after the user logs into the little
Below is a question from Kathy & Bert Bates SCJP 5 preparation CD. I

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.