NSLU2-Linux
view · edit · print · history

HowTo.BeepMelodies History

Hide minor edits - Show changes to markup

January 04, 2014, at 01:36 PM by Jeanrenaud Yves -- updated slugtunes.sh for better performance and correct timing
Changed lines 65-76 from:
 #! /bin/bash
 # slugtunes.sh - Play simple notes via the nslu2 speaker
 # Usage: slugtunes.sh notes.txt
 # notes.txt is a tab delimited file with the following format
 # freq(hz)	duration(ms)	delay(ms)
 # lines beginning with #'s are treated as comments
 #
 # Copyright Rajiv Narayan, 12.19.2008
 # Based on the leds script in nslu2-utils debian package

 BEEP="/usr/bin/beep"
 if [ ! -f "$1" ]; then
to:
  1. ! /bin/bash
  2. slugtunes.sh - Play simple notes via the nslu2 speaker
  3. Usage: slugtunes.sh notes.txt
  4. notes.txt is a tab delimited file with the following format
  5. freq(hz) duration(ms) delay(ms)
  6. lines beginning with #'s are treated as comments
  7. Copyright Rajiv Narayan, 12.19.2008
  8. Based on the leds script in nslu2-utils debian package
  9. modified by Yves Jeanrenaud, 03.01.2013

BEEP="/usr/bin/beep" if [ ! -f "$1" ]; then

Changed line 80 from:
 else
to:

else

Added line 83:
	str=
Changed line 106 from:
			$BEEP $arg -f ${notes[$st]} -l ${notes[$(($st+1))]} -d ${notes[$(($st+2))]} 2>/dev/null 
to:
			str+=" -f ${notes[$st]} -l ${notes[$(($st+1))]} -D ${notes[$(($st+2))]} -n" 
Added lines 108-110:
		str=${str%-n}
		#echo $BEEP $arg $str
		$BEEP $arg $str
Changed lines 114-115 from:
 fi
to:

fi

March 17, 2009, at 01:21 AM by slebetmanyahoocom --
Changed line 199 from:
      exec /bin/beep -f $scale($note) -l $delay
to:
      exec beep -f $scale($note) -l $delay
March 16, 2009, at 11:06 AM by slebetmanyahoocom --
Added line 128:
March 16, 2009, at 11:05 AM by slebetmanyahoocom --
Changed line 128 from:
to:

[@

Changed lines 228-229 from:
to:

@]

Added line 231:

[@

Added line 237:

@]

March 16, 2009, at 10:57 AM by slebetmanyahoocom --
Added lines 60-61:

Deleted line 110:

Added lines 124-125:

Deleted line 228:

March 16, 2009, at 10:56 AM by slebetmanyahoocom -- Play Nokia RTTL ringtones
Changed lines 121-232 from:
 440	120	140
to:
 440	120	140

Play Nokia RTTL Ringtone from a file

Here's a tcl script that plays Nokia RTTL (Ring Tone Transfer Language) ring tones from a file as beeps. You need tcl installed but that's just an apt-get away for a Debian user:

  #! /usr/bin/env tclsh
  # nokia2beeps.tcl - Play an RTTL ringtone file as beeps
  # Usage: ./nokia2beeps.tcl ringtone_file
  set default_octave 4
  set default_duration 4
  set default_beat 100
  set base_time 200000

  array set scale {
    C0   16.35    C#0  17.32    Db0  17.32    D0   18.35    D#0  19.45    Eb0  19.45
    E0   20.60    F0   21.83    F#0  23.12    Gb0  23.12    G0   24.50    G#0  25.96
    Ab0  25.96    A0   27.50    A#0  29.14    Bb0  29.14    B0   30.87    C1   32.70
    C#1  34.65    Db1  34.65    D1   36.71    D#1  38.89    Eb1  38.89    E1   41.20
    F1   43.65    F#1  46.25    Gb1  46.25    G1   49.00    G#1  51.91    Ab1  51.91
    A1   55.00    A#1  58.27    Bb1  58.27    B1   61.74    C2   65.41    C#2  69.30
    Db2  69.30    D2   73.42    D#2  77.78    Eb2  77.78    E2   82.41    F2   87.31
    F#2  92.50    Gb2  92.50    G2   98.00    G#2  103.83   Ab2  103.83   A2   110.00
    A#2  116.54   Bb2  116.54   B2   123.47   C3   130.81   C#3  138.59   Db3  138.59
    D3   146.83   D#3  155.56   Eb3  155.56   E3   164.81   F3   174.61   F#3  185.00
    Gb3  185.00   G3   196.00   G#3  207.65   Ab3  207.65   A3   220.00   A#3  233.08
    Bb3  233.08   B3   246.94   C4   261.63   C#4  277.18   Db4  277.18   D4   293.66
    D#4  311.13   Eb4  311.13   E4   329.63   F4   349.23   F#4  369.99   Gb4  369.99
    G4   392.00   G#4  415.30   Ab4  415.30   A4   440.00   A#4  466.16   Bb4  466.16
    B4   493.88   C5   523.25   C#5  554.37   Db5  554.37   D5   587.33   D#5  622.25
    Eb5  622.25   E5   659.26   F5   698.46   F#5  739.99   Gb5  739.99   G5   783.99
    G#5  830.61   Ab5  830.61   A5   880.00   A#5  932.33   Bb5  932.33   B5   987.77
    C6   1046.50  C#6  1108.73  Db6  1108.73  D6   1174.66  D#6  1244.51  Eb6  1244.51
    E6   1318.51  F6   1396.91  F#6  1479.98  Gb6  1479.98  G6   1567.98  G#6  1661.22
    Ab6  1661.22  A6   1760.00  A#6  1864.66  Bb6  1864.66  B6   1975.53  C7   2093.00
    C#7  2217.46  Db7  2217.46  D7   2349.32  D#7  2489.02  Eb7  2489.02  E7   2637.02
    F7   2793.83  F#7  2959.96  Gb7  2959.96  G7   3135.96  G#7  3322.44  Ab7  3322.44
    A7   3520.00  A#7  3729.31  Bb7  3729.31  B7   3951.07  C8   4186.01  C#8  4434.92
    Db8  4434.92  D8   4698.64  D#8  4978.03  Eb8  4978.03
  }

  proc nokia2scale {note} {
    global default_octave
    set note [string toupper [regexp -inline {[a-gA-GpP?].*} $note]]
    if {$note != "P" && ![regexp {\d$} $note]} {
      append note $default_octave
    }
    set note [string map {. ""} $note]
    return $note
  }

  proc nokia2length {note} {
    global default_duration default_beat base_time
    set duration [regexp -inline {^\d+} $note]
    if {$duration == ""} {
      set duration $default_duration
    }
    return [expr {$base_time/$default_beat/$duration}]
  }

  proc playnote {note} {
    global scale

    set note [string trim $note]
    if {$note == ""} return

    puts -nonewline "$note "   
    flush stdout

    set delay [nokia2length $note]
    set note  [nokia2scale  $note]

    if {$note == "P"} {
      after $delay
    } else {
      exec /bin/beep -f $scale($note) -l $delay
    }
  }

  proc playRTTL {str} {
    global default_octave default_beat default_duration

    foreach x [regexp -inline -all {[dob]=\d+} $str] {
      regexp {(\w)=(\d+)} $x -> param value
      switch $param {
        d {set default_duration $value}
        o {set default_octave   $value}
        b {set default_beat   $value}
      }
    }

    regexp {\:([^\:]+)$} $str -> str
    puts "beat: $default_beat"

    foreach x [split $str ,] {
      playnote $x
    }
    puts done.
  }

  set f [open [lindex $argv 0]]
  set data [read $f]
  close $f

  playRTTL $data

Sample RTTL file (Jingle Bells)

  JingleBells?:d=4,o=5,b=125:8g,8e6,8d6,8c6,2g,8g,8e6,8d6,8c6,2a,8a,8f6,8e6,
  8d6,8b,8g,8b,8d6,8g.6,16g6,8f6,8d6,2e6,8g,8e6,8d6,8c6,2g,16f#,8g,8e6,
  8d6,8c6,2a,8a,8f6,8e6,8d6,8g6,16g6,16f#6,16g6,16f#6,16g6,16g#6,8a.6,
  16g6,8e6,8d6,c6,g6,8e6,8e6,8e.6,16d#6,8e6,8e6,8e.6,16d#6,8e6,8g6,8c.6,
  16d6,2e6,8f6,8f6,8f.6,16f6,8f6,8e6,8e6,16e6,16e6,8e6,8d6,8d6,8e6,2d6
December 19, 2008, at 11:38 PM by Rajiv Narayan --
Changed lines 63-74 from:
  1. ! /bin/bash
  2. slugtunes.sh - Play simple notes via the nslu2 speaker
  3. Usage: slugtunes.sh notes.txt
  4. notes.txt is a tab delimited file with the following format
  5. freq(hz) duration(ms) delay(ms)
  6. lines beginning with #'s are treated as comments
  7. Copyright Rajiv Narayan, 12.19.2008
  8. Based on the leds script in nslu2-utils debian package

BEEP="/usr/bin/beep" if [ ! -f "$1" ]; then

to:
 #! /bin/bash
 # slugtunes.sh - Play simple notes via the nslu2 speaker
 # Usage: slugtunes.sh notes.txt
 # notes.txt is a tab delimited file with the following format
 # freq(hz)	duration(ms)	delay(ms)
 # lines beginning with #'s are treated as comments
 #
 # Copyright Rajiv Narayan, 12.19.2008
 # Based on the leds script in nslu2-utils debian package

 BEEP="/usr/bin/beep"
 if [ ! -f "$1" ]; then
Changed line 77 from:

else

to:
 else
Changed lines 107-108 from:

fi

to:
 fi
Changed lines 111-121 from:
  1. Beethoven's Für Elise
  2. freq(hz) length(ms) pause(ms)

659 120 120 622 120 120 659 120 120 622 120 120 659 120 120 494 120 120 587 120 120 523 120 120 440 120 140

to:
 # Beethoven's Für Elise
 # freq(hz)	length(ms)	pause(ms)
 659	120	120
 622	120	120
 659	120	120
 622	120	120
 659	120	120
 494	120	120
 587	120	120
 523	120	120
 440	120	140
December 19, 2008, at 11:36 PM by Rajiv Narayan --
Changed lines 63-72 from:
  1. !/bin/bash
    1. slugtunes.sh - Play simple notes via the nslu2 speaker
    2. Usage: slugtunes.sh notes.txt
    3. notes.txt is a tab delimited file with the following format
    4. freq(hz) duration(ms) delay(ms)
    5. lines beginning with #'s are treated as comments
    6. Copyright Rajiv Narayan, 12.19.2008
    7. Based on the leds script in nslu2-utils debian package
to:
  1. ! /bin/bash
  2. slugtunes.sh - Play simple notes via the nslu2 speaker
  3. Usage: slugtunes.sh notes.txt
  4. notes.txt is a tab delimited file with the following format
  5. freq(hz) duration(ms) delay(ms)
  6. lines beginning with #'s are treated as comments
  7. Copyright Rajiv Narayan, 12.19.2008
  8. Based on the leds script in nslu2-utils debian package
Changed lines 111-112 from:
  1. Beethoven's Für Elise
  2. freq(hz) length(ms) pause(ms)
to:
  1. Beethoven's Für Elise
  2. freq(hz) length(ms) pause(ms)
December 19, 2008, at 11:35 PM by Rajiv Narayan -- bash script to play tunes from a file
Changed lines 58-121 from:

Shame on me: I simply forgot to do a chmod 755 beep .

to:

Shame on me: I simply forgot to do a chmod 755 beep .

Play tones from a file

I hacked together a simple bash script that plays the notes from a file, instead of having to specify them as arguments.

  1. !/bin/bash
    1. slugtunes.sh - Play simple notes via the nslu2 speaker
    2. Usage: slugtunes.sh notes.txt
    3. notes.txt is a tab delimited file with the following format
    4. freq(hz) duration(ms) delay(ms)
    5. lines beginning with #'s are treated as comments
    6. Copyright Rajiv Narayan, 12.19.2008
    7. Based on the leds script in nslu2-utils debian package

BEEP="/usr/bin/beep" if [ ! -f "$1" ]; then

	echo "Usage: $0 notes.txt"
	exit 1

else

	declare -a notes
	arg=
	#read tunes
	notes=(`grep -v '^#' $1`)
	nnotes=$((${#notes[*]}/3))

	if [ -x $BEEP ];
	then
		#search for speaker device
		devices=`ls -d /sys/class/input/event*`
		for device in $devices
		do
			module=`egrep PHYSDEVDRIVER $device'/uevent' | cut -d '=' -f 2`
			if test "$module" = "ixp4xx-beeper";
			then
				devname=`basename "$device"`
				arg="-e /dev/input/"$devname
				break
			fi
		done
		# play tunes
		for i in $(seq 1 $nnotes) 
		do 
			st=$((($i-1)*3)) 
			$BEEP $arg -f ${notes[$st]} -l ${notes[$(($st+1))]} -d ${notes[$(($st+2))]} 2>/dev/null 
		done
	else
		echo "$BEEP not found"
	fi

fi


Sample input file

  1. Beethoven's Für Elise
  2. freq(hz) length(ms) pause(ms)

659 120 120 622 120 120 659 120 120 622 120 120 659 120 120 494 120 120 587 120 120 523 120 120 440 120 140

July 11, 2008, at 06:12 PM by setti --
Changed lines 9-17 from:
  1. ! /bin/sh
    1. BEGIN INIT INFO
  2. Provides: beep
  3. Required-Start:
  4. Required-Stop:
  5. Default-Start: 2 3 4 5
  6. Default-Stop: S 0 1 6
  7. Short-Description: Beeps that indicate startup and shutdown
    1. END INIT INFO
to:
 #! /bin/sh
 ### BEGIN INIT INFO
 # Provides:          beep
 # Required-Start:
 # Required-Stop:
 # Default-Start:     2 3 4 5
 # Default-Stop:      S 0 1 6
 # Short-Description: Beeps that indicate startup and shutdown
 ### END INIT INFO
Changed line 19 from:
  1. Do NOT "set -e"
to:
 # Do NOT "set -e"
Changed lines 21-47 from:
  1. PATH should only include /usr/* if it runs after the mountnfs.sh script

NAME=beep BEEP=/usr/bin/$NAME MELODY_START="-f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100" MELODY_STOP="-f 523.251 -l 100 -D 100 -n -f 391.995 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 -n -f 261.626 -l 200" SCRIPTNAME=/etc/init.d/$NAME ARGS="-e /dev/input/event0"

  1. Exit if the package is not installed

[ -x "$BEEP" ] || exit 0

case "$1" in

  start)
        $BEEP $ARGS $MELODY_START
        ;;
  stop)
        $BEEP $ARGS $MELODY_STOP
        ;;
  restart|force-reload)
        # Do nothing
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;

esac

to:
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 NAME=beep
 BEEP=/usr/bin/$NAME
 MELODY_START="-f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100"
 MELODY_STOP="-f 523.251 -l 100 -D 100 -n -f 391.995 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 -n -f 261.626 -l 200"
 SCRIPTNAME=/etc/init.d/$NAME
 ARGS="-e /dev/input/event0"

 # Exit if the package is not installed
 [ -x "$BEEP" ] || exit 0

 case "$1" in
   start)
         $BEEP $ARGS $MELODY_START
         ;;
   stop)
         $BEEP $ARGS $MELODY_STOP
         ;;
   restart|force-reload)
         # Do nothing
         ;;
   *)
         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
         exit 3
         ;;
 esac
July 11, 2008, at 06:11 PM by setti -- easier to copy now
Changed lines 9-17 from:
 #! /bin/sh
 ### BEGIN INIT INFO
 # Provides:          beep
 # Required-Start:
 # Required-Stop:
 # Default-Start:     2 3 4 5
 # Default-Stop:      S 0 1 6
 # Short-Description: Beeps that indicate startup and shutdown
 ### END INIT INFO
to:
  1. ! /bin/sh
    1. BEGIN INIT INFO
  2. Provides: beep
  3. Required-Start:
  4. Required-Stop:
  5. Default-Start: 2 3 4 5
  6. Default-Stop: S 0 1 6
  7. Short-Description: Beeps that indicate startup and shutdown
    1. END INIT INFO
Changed line 19 from:
 # Do NOT "set -e"
to:
  1. Do NOT "set -e"
Changed lines 21-47 from:
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 NAME=beep
 BEEP=/usr/bin/$NAME
 MELODY_START="-f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100"
 MELODY_STOP="-f 523.251 -l 100 -D 100 -n -f 391.995 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 -n -f 261.626 -l 200"
 SCRIPTNAME=/etc/init.d/$NAME
 ARGS="-e /dev/input/event0"

 # Exit if the package is not installed
 [ -x "$BEEP" ] || exit 0

 case "$1" in
   start)
         $BEEP $ARGS $MELODY_START
         ;;
   stop)
         $BEEP $ARGS $MELODY_STOP
         ;;
   restart|force-reload)
         # Do nothing
         ;;
   *)
         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
         exit 3
         ;;
 esac
to:
  1. PATH should only include /usr/* if it runs after the mountnfs.sh script

NAME=beep BEEP=/usr/bin/$NAME MELODY_START="-f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100" MELODY_STOP="-f 523.251 -l 100 -D 100 -n -f 391.995 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 -n -f 261.626 -l 200" SCRIPTNAME=/etc/init.d/$NAME ARGS="-e /dev/input/event0"

  1. Exit if the package is not installed

[ -x "$BEEP" ] || exit 0

case "$1" in

  start)
        $BEEP $ARGS $MELODY_START
        ;;
  stop)
        $BEEP $ARGS $MELODY_STOP
        ;;
  restart|force-reload)
        # Do nothing
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;

esac

April 19, 2008, at 07:08 PM by Nightwolf -- Solution to the problem
Changed lines 56-58 from:

Did not work for me. Running the script works flawless but it won't beep on boot or shutdown. I'm using NSLU2 Stable 4.0r3.

to:

Did not work for me. Running the script works flawless but it won't beep on boot or shutdown. I'm using NSLU2 Stable 4.0r3.

Shame on me: I simply forgot to do a chmod 755 beep .

April 19, 2008, at 11:42 AM by Nightwolf -- Can\'t get it work
Changed lines 52-56 from:

Alternatively make BEEP="/usr/bin/leds" and ARGS="beep" if you have nslu2-utils installed as well.

to:

Alternatively make BEEP="/usr/bin/leds" and ARGS="beep" if you have nslu2-utils installed as well.

Problems

Did not work for me. Running the script works flawless but it won't beep on boot or shutdown. I'm using NSLU2 Stable 4.0r3.

November 17, 2007, at 08:22 PM by astraw -- Add Debian package instructions
Changed lines 48-49 from:

Note: This Howto is also applicable for SlugOS.

to:

Note: This Howto is also applicable for SlugOS. On Debian, /usr/bin/beep is installed by the "beep" package.

July 27, 2007, at 10:17 PM by Robert --
March 30, 2007, at 04:35 AM by MarkStinson -- Adding confirmation for SlugOS
Added lines 48-49:

Note: This Howto is also applicable for SlugOS.

March 17, 2007, at 05:46 PM by hs -- move to Debian and merge suggested changes
Changed lines 3-4 from:

Booting DebianSlug takes a while, so I wanted to have it beep, when it's ready for use. Also, as I turn off the nslu2 via a remote control command, I like to know if it's actually started to shut down.

to:

Booting Debian takes a while, so I wanted to have it beep, when it's ready for use. Also, as I turn off the nslu2 via a remote control command, I like to know if it's actually started to shut down.

Changed lines 7-8 from:

Put a script like the following in /etc/init.d/beep (on DebianSlug) and link it in /etc/rc?.d with update-rc.d beep defaults 99 04

to:

Put a script like the following in /etc/init.d/beep and link it in /etc/rc?.d with update-rc.d beep defaults 99 04

Changed line 23 from:
 BEEP=/bin/$NAME
to:
 BEEP=/usr/bin/$NAME
Changed lines 27-28 from:
 ARGS=""
to:
 ARGS="-e /dev/input/event0"
Changed lines 48-50 from:

Non-DebianSlug Debian

On a regular Debian install with "beep" installed, make ARGS="-e /dev/input/event0" and BEEP="/usr/bin/beep", or alternatively make BEEP="/usr/bin/leds" and ARGS="beep" if you have nslu2-utils installed as well.

to:

Using leds

Alternatively make BEEP="/usr/bin/leds" and ARGS="beep" if you have nslu2-utils installed as well.

January 01, 2007, at 02:51 AM by TBBle -- Correct update-rc.d syntax, add ARGS parameter and note usage on Debain (distinct from DebianSlug)
Changed lines 7-8 from:

Put a script like the following in /etc/init.d/beep (on DebianSlug) and link it in /etc/rc?.d with update-rc.d beep defaults s99 k04

to:

Put a script like the following in /etc/init.d/beep (on DebianSlug) and link it in /etc/rc?.d with update-rc.d beep defaults 99 04

Changed lines 27-28 from:
to:
 ARGS=""
Changed line 34 from:
         $BEEP $MELODY_START
to:
         $BEEP $ARGS $MELODY_START
Changed line 37 from:
         $BEEP $MELODY_STOP
to:
         $BEEP $ARGS $MELODY_STOP
Added lines 47-50:

Non-DebianSlug Debian

On a regular Debian install with "beep" installed, make ARGS="-e /dev/input/event0" and BEEP="/usr/bin/beep", or alternatively make BEEP="/usr/bin/leds" and ARGS="beep" if you have nslu2-utils installed as well.

October 21, 2006, at 07:19 PM by hs -- typo
Changed line 24 from:
 MELODY_START="beep -f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100"
to:
 MELODY_START="-f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100"
September 25, 2006, at 11:09 AM by hs -- new: Beep a melody on startup and shutdown
Changed lines 3-4 from:

Booting DebianSlug takes a while, so I wanted to have it beep, when it's ready for use. Also, as I turn down the nslu2 via a remote control command, I like to know if it's actually started to shut down.

to:

Booting DebianSlug takes a while, so I wanted to have it beep, when it's ready for use. Also, as I turn off the nslu2 via a remote control command, I like to know if it's actually started to shut down.

September 25, 2006, at 11:08 AM by hs -- new: Beep a melody on startup and shutdown
Added lines 1-45:

Intro

Booting DebianSlug takes a while, so I wanted to have it beep, when it's ready for use. Also, as I turn down the nslu2 via a remote control command, I like to know if it's actually started to shut down.

Script

Put a script like the following in /etc/init.d/beep (on DebianSlug) and link it in /etc/rc?.d with update-rc.d beep defaults s99 k04

 #! /bin/sh
 ### BEGIN INIT INFO
 # Provides:          beep
 # Required-Start:
 # Required-Stop:
 # Default-Start:     2 3 4 5
 # Default-Stop:      S 0 1 6
 # Short-Description: Beeps that indicate startup and shutdown
 ### END INIT INFO

 # Do NOT "set -e"

 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 NAME=beep
 BEEP=/bin/$NAME
 MELODY_START="beep -f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100"
 MELODY_STOP="-f 523.251 -l 100 -D 100 -n -f 391.995 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 -n -f 261.626 -l 200"
 SCRIPTNAME=/etc/init.d/$NAME

 # Exit if the package is not installed
 [ -x "$BEEP" ] || exit 0

 case "$1" in
   start)
         $BEEP $MELODY_START
         ;;
   stop)
         $BEEP $MELODY_STOP
         ;;
   restart|force-reload)
         # Do nothing
         ;;
   *)
         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
         exit 3
         ;;
 esac
view · edit · print · history · Last edited by Jeanrenaud Yves.
Based on work by slebetmanyahoocom, Rajiv Narayan, setti, Nightwolf, astraw, Robert, MarkStinson, hs, and TBBle.
Originally by hs.
Page last modified on January 04, 2014, at 01:36 PM