📄 audiblealarm.in
字号:
#!/bin/sh## Startup script for the Audible Alarm## author: Kirk Lawson <lklawson@heapy.com> # Horms <horms@vergenet.net>## description: sets an audiable alarm running by beeping at a set interval# processname: alarm# config: /etc/AudibleAlarm/AudibleAlarm.conf - not yet implemented## Licence: GPLprefix=@prefix@exec_prefix=@exec_prefix@PIDFILE=@localstatedir@/run/heartbeat-bell#For testing#PIDFILE=/tmp/heartbeat-bell# Source function library.. @sysconfdir@/ha.d/shellfuncs# What host are we running on?us=`uname -n`audiablealarm_start () { ha_log "info: $0: Starting" if [ -f $PIDFILE ]; then PID=`head -n 1 $PIDFILE` ha_log "info: $0: Appears to already be running, killing [$PID]" kill $PID > /dev/null fi while [ 1 ]; do sleep 1 #Sleep first, incase we bail out echo -ne "\a" > /dev/console # Uncomment this line to cause floppy drive light # to flash (requires fdutils package). # /usr/bin/floppycontrol --pollstate > /dev/null done& if ! echo $! > $PIDFILE; then ha_log "info: $0: Could not write to pid file \"$PIDFILE\", bailing" kill $! exit 1 fi}audiablealarm_stop () { ha_log "info: $0: Shutting down" if [ -f $PIDFILE ]; then PID=`head -n 1 $PIDFILE` ha_log "info: $0: Appears to already be running, killing [$PID]" kill $PID > /dev/null rm -f $PIDFILE fi}# Get last argument we are passed.for arg in "$@" do lastarg=$arg done# See how we were called.case "$lastarg" in start) for arg in "$@" do if [ "$us" = "$arg" ]; then # We should not start because we are on a host # listed in our argument list. exit 0 fi done audiablealarm_start ;; stop) audiablealarm_stop ;; restart) $0 stop $0 start ;; status) if [ -f $PIDFILE ]; then echo running else echo stopped fi ;; *) echo "Usage: [node1 node2 ... ] {start|stop|restart|status}" echo " The node list is an optional space delimited" echo " list of hosts that should never sound the alarm." echo "$Id: AudibleAlarm.in,v 1.1 2004/08/27 09:34:14 lars Exp $"; exit 1esacexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -