Project

General

Profile

Download (1.7 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2
#
3
# beep.sh
4
#
5
# part of pfSense (https://www.pfsense.org)
6
# Copyright (c) 2004-2013 BSD Perimeter
7
# Copyright (c) 2013-2016 Electric Sheep Fencing
8
# Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
9
# All rights reserved.
10
#
11
# Licensed under the Apache License, Version 2.0 (the "License");
12
# you may not use this file except in compliance with the License.
13
# You may obtain a copy of the License at
14
#
15
# http://www.apache.org/licenses/LICENSE-2.0
16
#
17
# Unless required by applicable law or agreed to in writing, software
18
# distributed under the License is distributed on an "AS IS" BASIS,
19
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
# See the License for the specific language governing permissions and
21
# limitations under the License.
22

    
23
BEEP=$(/usr/local/sbin/read_xml_tag.sh boolean system/disablebeep)
24
if [ "$BEEP" = "true" ]; then
25
	exit;
26
fi
27

    
28
# Standard note length
29
NOTELENGTH="25"
30

    
31
# this is super annoying in VMware, exit if in VMware
32
if [ -f /var/log/dmesg.boot ]; then
33
	VMWCOUNT=`/usr/bin/grep -c VMware /var/log/dmesg.boot`
34
	if [ $VMWCOUNT -gt 0 ]; then
35
		exit;
36
	fi
37
fi
38

    
39
# Check for different HZ
40
HZ=`/sbin/sysctl -qn kern.hz`
41
if [ "$HZ" = "1" ]; then
42
	NOTELENGTH="10"
43
fi
44

    
45
if [ -c "/dev/speaker" ]; then
46
	if [ "$1" = "start" ]; then
47
		/usr/local/bin/beep -p 500 $NOTELENGTH
48
		/usr/local/bin/beep -p 400 $NOTELENGTH
49
		/usr/local/bin/beep -p 600 $NOTELENGTH
50
		/usr/local/bin/beep -p 800 $NOTELENGTH
51
		/usr/local/bin/beep -p 800 $NOTELENGTH
52
	fi
53
	if [ "$1" = "stop" ]; then
54
		/usr/local/bin/beep -p 600 $NOTELENGTH
55
		/usr/local/bin/beep -p 800 $NOTELENGTH
56
		/usr/local/bin/beep -p 500 $NOTELENGTH
57
		/usr/local/bin/beep -p 400 $NOTELENGTH
58
		/usr/local/bin/beep -p 400 $NOTELENGTH
59
	fi
60
fi
(2-2/15)