summaryrefslogtreecommitdiffstats
path: root/usr/local/bin/beep.sh
blob: febb222c4a251f2f96e6469e49fc8ad7e1195b1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

# Standard note length
NOTELENGTH="25"

# Embedded uses 100HZ
if [ "$PFSENSETYPE" = "embedded" ]; then
	NOTELENGTH="10"
fi

# this is super annoying in VMware, exit if in VMware
VMWCOUNT=`/usr/bin/grep -c VMware /var/log/dmesg.boot`
if [ $VMWCOUNT -gt 0 ]; then
    exit;
fi

# Check for different HZ 
if [ -f /boot/loader.conf ]; then
	HZ=`/usr/bin/grep -c kern.hz /boot/loader.conf`
	if [ "$HZ" = "1" ]; then
		NOTELENGTH="10"
	fi
fi

if [ -c "/dev/speaker" ]; then	
		if [ "$1" = "start" ]; then
			/usr/local/bin/beep -p 500 $NOTELENGTH
			/usr/local/bin/beep -p 400 $NOTELENGTH
			/usr/local/bin/beep -p 600 $NOTELENGTH
			/usr/local/bin/beep -p 800 $NOTELENGTH
			/usr/local/bin/beep -p 800 $NOTELENGTH
		fi
		if [ "$1" = "stop" ]; then
			/usr/local/bin/beep -p 600 $NOTELENGTH
			/usr/local/bin/beep -p 800 $NOTELENGTH
			/usr/local/bin/beep -p 500 $NOTELENGTH
			/usr/local/bin/beep -p 400 $NOTELENGTH
			/usr/local/bin/beep -p 400 $NOTELENGTH
		fi
fi
OpenPOWER on IntegriCloud