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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:12:33+00:00 2026-06-17T04:12:33+00:00

I’m downloaded tracd init.d startup script from here and I’m trying to adopt it

  • 0

I’m downloaded tracd init.d startup script from here and I’m trying to adopt it to my own server. But when I’m running script I get folowing error message:

Usage: tracd [options] [projenv] ...

tracd: error: the --single-env option cannot be used with more than one enviroment

So I’m trying to modify the script to get it working. This is my actual version:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tracd
# Required-Start:    networking
# Required-Stop:     networking
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the tracd standalone Trac web server.
### END INIT INFO
# (C) 2008 Guy Rutenberg <http://www.guyrutenberg.com>

## Options you should probably change ##
HOSTNAME=193.17.184.23 # to which hostname should we listen
# If you only want to serve one project keep this variable
# empty and set the PROJECT_ENV variable 
ENV_PARENT_DIR=
PROJECT_ENV=/opt/trac/bds5/
PORT=8000
# add any additional options (such as authentication) here. If you only have one
# project you should probably add -s here
ADDITIONAL_OPTS='-s --basic-auth="bds5,/opt/trac/bds5/.htpasswd,Baza Doskonalenia Systemu"'

## Options you should probably not change ##
DAEMON=/usr/local/bin/tracd
NAME=tracd-bds5
DESC="web server"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
SSD="/sbin/start-stop-daemon"

test -x $DAEMON || exit 1

set -e

. /lib/lsb/init-functions

DAEMON_OPTS="--daemonize --pidfile=$PIDFILE --port=$PORT --hostname=$HOSTNAME $ADDITIONAL_OPTS"
if [ -n "$ENV_PARENT_DIR" ]; then
    DAEMON_OPTS="$DAEMON_OPTS --env-parent-dir=$ENV_PARENT_DIR"
else
    DAEMON_OPTS="$DAEMON_OPTS $PROJECT_ENV"
fi

case "$1" in
  start)
    log_daemon_msg "Starting $DESC" $NAME
    echo "$SSD --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS" 
    $SSD --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
    if [[ -n $! ]]; then
            log_end_msg 0
    else
            log_end_msg 1
    fi
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" $NAME
    if $SSD --stop --retry 30\
    --pidfile $PIDFILE ; then
        rm -f $PIDFILE
        log_end_msg 0
    else
        log_end_msg 1
    fi
    ;;
  restart|force-reload)
    $0 stop
    [ -r  $PIDFILE ] && while pidof -x $NAME |\
         grep -q `cat $PIDFILE 2>/dev/null` 2>/dev/null ; do sleep 1; done
    $0 start
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

And this is it’s output:

Starting web server: tracd-bds5
/sbin/start-stop-daemon --start --quiet --pidfile /var/run/tracd-bds5.pid --exec /usr/local/bin/tracd -- --daemonize --pidfile=/var/run/tracd-bds5.pid --port=8000 --hostname=127.0.0.1 -s --basic-auth="bds5,/opt/trac/bds5/.htpasswd,Baza Doskonalenia Systemu" /opt/trac/bds5/
Usage: tracd [options] [projenv] ...

tracd: error: the --single-env option cannot be used with more than one enviroment

What is funny – when I copy the command from terminal and run it, everthing works fine. So I think that there is a problem whith runnitg this command from scrit. What am I doing wrong?

  • 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-17T04:12:34+00:00Added an answer on June 17, 2026 at 4:12 am

    Short answer: see BashFAQ #050: I’m trying to put a command in a variable, but the complex cases always fail!

    Long answer: when bash parses a command line, it looks for (& acts on) quotes and escapes before it substitutes variables. So when a variable contains something like -s --basic-auth="bds5,/opt/trac/bds5/.htpasswd,Baza Doskonalenia Systemu", by the time that value gets included in the command line, it’s too late for the quotes in it to do anything useful.

    If you need to store complex command options in a variable, your best option is to use an array. Each shell word gets stored as a separate element in the array, and if you expand the array right (as "$arrayname[@]}") that gets preserved and passed to the command intact:

    ADDITIONAL_OPTS=(-s --basic-auth="bds5,/opt/trac/bds5/.htpasswd,Baza Doskonalenia Systemu")
    ...
    DAEMON_OPTS=(--daemonize --pidfile=$PIDFILE --port=$PORT --hostname=$HOSTNAME "${ADDITIONAL_OPTS[@]}")
    if [ -n "$ENV_PARENT_DIR" ]; then
        DAEMON_OPTS+=(--env-parent-dir=$ENV_PARENT_DIR)
    else
        DAEMON_OPTS+=($PROJECT_ENV)
    fi
    ...
    $SSD --start --quiet --pidfile $PIDFILE --exec $DAEMON -- "${DAEMON_OPTS[@]}"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:

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.