语法错误";;意外的"关于Debian的简单初始化脚本 [英] Syntax error of ";; unexpected" on simple init script for Debian

查看:84
本文介绍了语法错误";;意外的"关于Debian的简单初始化脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个初始化脚本来运行uwsgi.它有效,但仅在启动命令上有效.所有其他命令给我这个错误:

I have this init script to run uwsgi. It works, but only on the start command. All the other commands give me this error:

/etc/init.d/uwsgi: 27: /etc/init.d/uwsgi: Syntax error: ";;" unexpected

似乎我正在阅读的教程中应该有冒号,但是它告诉我删除它们?

It seems like the colons should be there from the tutorials I am reading, and yet it is telling me to remove them?

#!/bin/sh
### BEGIN INIT INFO
# Provides:          uwsgi
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       This script manages uWSGI.
### END INIT INFO

DAEMON=/var/www/app/venv/bin/uwsgi
PIDFILE=/var/run/uwsgi.pid
DAEMON_ARGS="--ini /var/www/app/conf/uwsgi/app.ini --pidfile /var/run/uwsgi.pid"

. /lib/init/vars.sh
. /lib/lsb/init-functions

case "$1" in
  start)
  echo "Starting"
  start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
    || return 1
  start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
    $DAEMON_ARGS 1> /dev/null 2>&1 \
    || return 2
  esac
  ;;
  stop)
  echo "Stopping"
  start-stop-daemon --stop --quiet --retry=QUIT/30/KILL/5 --pidfile $PIDFILE --name uwsgi
  RETVAL="$?"
  [ "$RETVAL" = 2 ] && return 2
  start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
  [ "$?" = 2 ] && return 2
  rm -f $PIDFILE
  return "$RETVAL"
  esac
  ;;
  status)
  status_of_proc "$DAEMON" "uwsgi" && exit 0 || exit $?
  ;;
  reload)
  echo "Reloading"
  start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name uwsgi
  return 0
  ;;
  *)
  echo "Usage: /etc/init.d/uwsgi {start|stop|status|reload|force-reload}" >&2
  exit 3
  ;;
esac
exit 0

推荐答案

;;之前删除esac关键字.末尾应该只有一个与最初的case关键字匹配.

Get rid of the esac keywords before the ;;s. There should only be one at the very end to match the initial case keyword.

这篇关于语法错误";;意外的"关于Debian的简单初始化脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆