⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vsntp.debian

📁 一个开源的NTP客户端程序
💻 DEBIAN
字号:
#!/bin/sh# start and stop the SNTP client for Virtual PC# LSB-convension comments# See: http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html### BEGIN INIT INFO# Provides:          vsntp# Required-Start:    $network $time# Required-Stop:     # Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: start and stop the SNTP client for Virtual PC# Description:       vsntp is a SNTP client for Virtual PC that synchronize#                    time periodically for systems without hardward RTC.### END INIT INFOexport PATH=/sbin:/bin:/usr/sbin:/usr/binTHISFILE=${0##*/}VERSION=1.1.0AUTHORNAME=imacatAUTHORMAIL=imacat@mail.imacat.idv.twDESC="SNTP client for Virtual PC"THISCONF=/etc/default/vsntp# source the configurationtest -e $THISCONF && . $THISCONFcase "$SCHEDULER" inalarm|a|-a|--alarm)  SCHEDULER=-a ;;*)  SCHEDULER=-s ;;esacBINPATH=/usr/sbin/vsntpBINNAME=${BINPATH##*/}PIDFILE=/var/run/$BINNAME.pidRUNUSER=root# default values -- do not change anything here_DEFSYNC_INTERVAL=900_DEFSCHEDULER=-s# startup optionsOPTS=""test -n "$SCHEDULER" -a "$SCHEDULER" != "$_DEFSCHEDULER" && OPTS="$OPTS $SCHEDULER"test -n "$SYNC_INTERVAL" -a "$SYNC_INTERVAL" != "$_DEFSYNC_INTERVAL" && OPTS="$OPTS -i $SYNC_INTERVAL"OPTS="$OPTS $SERVER"# sanity checksif test ! -n "$SERVER"; then  echo "$THISFILE: You must set the SERVER in $THISCONF" >&2  exit 1fiif test ! -x $BINPATH; then  echo "$THISFILE: Missing valid daemon program at $BINPATH" >&2  exit 1fiif test -n "$USER" -a ! "$USER" = "root"; then  echo "$THISFILE: You need to be root to run this script." >&2  exit 1fistart () {  echo -n "Starting $DESC:"  RETVAL=0    echo -n " $BINNAME"  start-stop-daemon --start --startas $BINPATH --quiet \    --pidfile $PIDFILE --name $BINNAME --user $RUNUSER --exec $BINPATH -- $OPTS  RETVALS=$?  test $RETVALS = 0 || { echo -n ":failed"; RETVAL=$RETVALS; }    echo "."  return $RETVAL}stop () {  echo -n "Stopping $DESC:"  RETVAL=0    echo -n " $BINNAME"  start-stop-daemon --stop --quiet \    --pidfile $PIDFILE --name $BINNAME --user $RUNUSER --exec $BINPATH  RETVALS=$?  test $RETVALS = 0 || { echo -n ":failed"; RETVAL=$RETVALS; }  rm -f $PIDFILE    echo "."  return $RETVAL}restart () {  stop  sleep 1  start  RETVAL=$?  return $RETVAL}status () {  RETVAL=0    start-stop-daemon --stop --signal 0 --quiet \    --pidfile $PIDFILE --name $BINNAME --user $RUNUSER --exec $BINPATH  RETVALS=$?  if test $RETVALS = 0; then    echo "$DESC $BINNAME is up and running ($(<$PIDFILE))."  else    echo "$DESC $BINNAME is not running (or some problem may exists)."    RETVAL=$RETVALS  fi    return $RETVAL}# parse the argumentswhile test $# != 0; do  case "$1" in  start|stop|restart|force-reload|status)    action="$1"    ;;  -h|--help)    cat << EOFStart and/or stop the $DESCUsage: $THISFILE {start|stop|restart|force-reload|status}  start          Start the daemon.  stop           Stop the daemon.  restart        Stop and restart the daemon.  force-reload   Enforce a reload to the configuration file.  status         Display the daemon status.  -h,--help      Display this help.  -v,--version   Display the version infomation.Report bugs to $AUTHORNAME <$AUTHORMAIL>EOF    exit 0    ;;  -v|--version)    cat << EOF$THISFILE version $VERSION by $AUTHORNAME <$AUTHORMAIL>EOF    exit 0    ;;  *)    echo "$THISFILE: unrecognized argument: $1" >&2    echo "Try \`$THISFILE --help' for more infomation" >&2    exit 1    ;;  esac  shiftdone# no action specifiedif test -z "$action"; then  echo "$THISFILE: what do you want to do now?" >&2  echo "Try \`$THISFILE --help' for more infomation" >&2  exit 1fi# act now!case "$action" instart)  start  RETVAL=$?  ;;stop)  stop  RETVAL=$?  ;;restart|force-reload)  restart  RETVAL=$?  ;;status)  status  RETVAL=$?  ;;esacexit $RETVAL

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -