一个shell代码 ?谁能帮我写 注释 啊 尤其是路径什么的? 拜托各位 英雄了

废墟海岸 2004-12-15 02:11:19
#! /bin/bash
#
# saslauthd Start/Stop the SASL authentication daemon.
#
# chkconfig: - 95 05
# description: saslauthd is a server process which handles plaintext \
# authentication requests on behalf of the cyrus-sasl library.
# processname: saslauthd

# Source function library.
. /etc/init.d/functions

# Source our configuration file for these variables.
SOCKET=/var/run/saslauthd/mux
MECH=shadow
FLAGS=
if [ -f /etc/sysconfig/saslauthd ] ; then
. /etc/sysconfig/saslauthd
fi

RETVAL=0

# Set up some common variables before we launch into what might be
# considered boilerplate by now.
prog=saslauthd
path=/usr/sbin/saslauthd

start() {
echo -n $"Starting $prog: "
daemon $path -m $SOCKET -a $MECH $FLAGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}

stop() {
echo -n $"Stopping $prog: "
killproc $path
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}

restart() {
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status $path
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
exit 1
esac

exit $?
...全文
116 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
gettext 2004-12-16
  • 打赏
  • 举报
回复
标准的 services 脚本
louis82 2004-12-15
  • 打赏
  • 举报
回复
這麼短的程序一眼就明白,怎麼寫注釋啊?

1.函數主體是根據輸入參數,分別執行start,stop, restart, status, condrestart
1. start函數:執行daemon命令,如果成功,在/var/lock/subsys目錄下創建文件saslauthd
2. stop函數:執行killproc命令,如果成功,刪除/var/lock/subsys目錄下文件saslauthd
3. restart函數不用注釋吧?
4. condrestart: 如果/var/lock/subsys目錄下文件saslauthd存在, restart!

18,828

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 专题技术讨论区
社区管理员
  • 专题技术讨论区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧