Fix os-svc-restart to exit correctly without -n.

Similar to os-svc-enable, it was trying to run when invoked
incorrectly.

Change-Id: Ice285d3796149f0c82521da7c5112375cf15c1fe
This commit is contained in:
Robert Collins 2014-02-05 13:00:55 +13:00
parent 51e2d265d2
commit 0c38854ef9
1 changed files with 5 additions and 4 deletions

View File

@ -23,6 +23,7 @@ usage() {
echo " -h Show help and exit"
echo " -n SERVICENAME Name of job/service file."
echo ""
exit $1
}
SERVICENAME=${SERVICENAME:-""}
@ -31,15 +32,15 @@ nshift=0
while getopts "hn:" opt; do
case "$opt" in
n) SERVICENAME=$OPTARG;;
h) usage; exit 0;;
\?) usage; exit 1;;
:) usage; exit 1;;
h) usage 0;;
\?) usage 0;;
:) usage 1;;
esac
done
shift $(($OPTIND-1))
if [ -z "$SERVICENAME" ] ; then
usage
usage 1
fi
function restart_upstart_service {