共计 1081 个字符,预计需要花费 3 分钟才能阅读完成。
#!/bin/sh /etc/rc.common
START=90
STOP=10
enable="$(uci -q get gost.arguments.enable)"
prog_path="$(uci -q get gost.arguments.path)"
configure_file="$(uci -q get gost.options.configure_file)"
prog=`basename $prog_path`
start()
{
["x${enable}" != "xtrue" ] && exit 0
pid=`ps | grep -v grep | grep -v etc | grep -i "$prog" | awk ‘{print $1}’`
if ["x$pid" == "x"]; then
$prog_path -C $configure_file 2>&1 > /var/log/$prog.log &
echo -e "n$prog started!n"
else
## program is running, exit with error.
echo -e "nError! $prog is currently running!n" 1>&2
exit 1
fi
}
stop() {
pid=`ps | grep -v grep | grep -v etc | grep -i "$prog" | awk ‘{print $1}’`
if ["x$pid" == "x"]; then
## Program is not running, exit with error.
echo -e "nError! $prog not started!n" 1>&2
exit 1
else
## Program is running, so stop it
kill -15 $pid
echo -e "n$prog stopped!n"
fi
}
restart() {
stop
start
}
复制代码
报如下错误
/etc/rc.common: /etc/init.d/gost: line 20: syntax error: unexpected "then" (expecting "}") 复制代码我看不出来有语法错误啊
上一篇:2T 的 U 盘套路
下一篇:hosthatch 的东京鸡失联?
AI 说没有明显的语法错误。。。看错了 … 看下文件编码格式, 还有 unix, 中文什么的
dongshuyuu 发表于 2022-12-19 15:49
看下文件编码格式, 还有 unix, 中文什么的
直接用 vim 编辑的,编码格式肯定没问题既是 bash,随便找个小鸡调试一下咯 v2 v3 版本都试试,注意架构版本,直接运行文件