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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:49:41+00:00 2026-06-10T00:49:41+00:00

I found this small shell script in a book… NGiNX works it just this

  • 0

I found this small shell script in a book… NGiNX works it just this script that just does not work. Because every time I do /etc/init.d/nginx start (that is where the file is) it sends me this message: Usage: /etc/init.d/nginx {start|stop|restart|reload}

For testing purposes I added a echo “$1” and it sends me -e when I do: /etc/init.d/nginx start Or anything else…

I am using Ubuntu 12.04.

#! /bin/sh
# Author: Ryan Norbauer http://norbauerinc.com
# Modified: Geoffrey Grosenbach http://topfunky.com
# Modified: Clement NEDELCU
# Reproduced with express authorization from its contributors
set –e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx daemon"
NAME=nginx
DAEMON=/usr/local/nginx/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
# If the daemon file is not found, terminate the script.
test -x $DAEMON || exit 0
echo "0"
d_start() {
$DAEMON || echo -n " already running"
}

d_stop() {
$DAEMON –s quit || echo -n " not running"
}

d_reload() {
$DAEMON –s reload || echo -n " could not reload"
}
echo "$1"
case "$1" in
    start)
            echo -n "Starting $DESC: $NAME"
            d_start
            echo "."
    ;;
    stop)
            echo -n "Stopping $DESC: $NAME"
            d_stop
            echo "."
    ;;
    reload)
            echo -n "Reloading $DESC configuration..."
            d_reload
            echo "reloaded."
    ;;
    restart)
            echo -n "Restarting $DESC: $NAME"
            d_stop
            # Sleep for two seconds before starting again, this should give the
            # Nginx daemon some time to perform a graceful stop.
            sleep 2
            d_start
            echo "."
            ;;
    *)
            echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
            exit 3
    ;;
esac

exit 0
  • 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-10T00:49:42+00:00Added an answer on June 10, 2026 at 12:49 am

    set –e is setting the list of arguments to the script to –e. Remove that line and the script will work.

    Edit: The script posted contains set –e (that is EN DASH + e) as opposed to set -e (ASCII hyphen/minus sign + e). This caused sh to override the first argument passed with –e instead of setting the -e option in the shell. Replacing – with - should fix the problem.

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

Sidebar

Related Questions

I've found this small code that sends email to gmail users. I'd like the
This is from a small library that I found online: const char* GetHandStateBrief(const PostFlopState*
I've found this way of creating a directory if it does not exist. But
I wrote a small shell script based on an example I found here: https://bbs.archlinux.org/viewtopic.php?id=36305
I found this css body { font: 13px/1.231 arial,helvetica,clean,sans-serif; *font-size: small; *font: x-small; }
Found This: tyty stack, Social Icons not working with Infinite Scrolling on Wordpress I'm
found this little code snippet that seems to do what i want, but im
Found this Multimap containing pairs? , but it is not much help How would
OS X does not make it obvious that you might've left a screen sharing
I just found myself creating a class called InstructionBuilderFactoryMapFactory. That's 4 pattern suffixes on

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.