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 699307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:22:19+00:00 2026-05-14T03:22:19+00:00

I have been trying to make an init script using start-stop-daemon. I am stuck

  • 0

I have been trying to make an init script using start-stop-daemon. I am stuck on the arguments to the daemon. I want to keep these in a variable at the top of the script but I can’t get the quotations to filter down correctly.

I’ll use ls here so we don’t have to look at binaries and arguments that most people wont know or care about.

The end result I am looking for is for start-stop… to run ls -la “/folder with space/”

DAEMON=/usr/bin/ls 
DAEMON_OPTS='-la "/folder with space/"'

start-stop-daemon --start --make-pidfile --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS

Double escaping the options and trying innumerable variations of quotations do not help… Then they end up at the daemon they are always messed up. Enclosing $DAEMON_OPTS in quotes changes things… then they are seen as one since quote… never the right number though 🙂

Echoing the command-line (start-stop…) prints exactly the right stuff to screen. But the daemon (the real one, not ls) complains about the wrong number of arguments.

How do I specify a variable so that quotes inside it are brought along to the daemon correctly?

  • 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-14T03:22:19+00:00Added an answer on May 14, 2026 at 3:22 am

    I thought I’d post the final quotations used in my working init script:

    COMMAND="/path/to/script -opt param param2 param3"
    DAEMON_OPTS=" 0.0.0.0:$PORT -dest $OUTPUT_DIRECTORY -command"
    
    start-stop-daemon --start --background --make-pidfile --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS "\"$COMMAND\""
    

    Obviously an incomplete and non-functional example but I hope you get the gist of it. The double quotations with the inner pair escaped is what did the trick.

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

Sidebar

Related Questions

I have been trying to make custom radio buttons using HTML, CSS, and JavaScript.
I have been trying to make graphs using the igraph library in c. I
Have have been trying to make a validator for my xml files. I have
I have been trying to make a div fade in evey 30sec and out
I have been trying to make the sub-menu horizontal. In my HTML it looks
I have been trying to make this to be a little jQuery plugin that
I have been trying to make a Cross-platform 2D Online Game, and my maps
I have been trying to make it work with either fwrite or fputcsv but
Hi I have been trying to make a ajax call to a JSP page.
I have been trying to use the ruby-git gem to make commits etc from

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.