Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are commands in Linux that will beep for you. Check out the source code for beep available with Ubuntu (and probably other distros) or have a look at <a href="http://www.johnath.com/beep/beep.c" rel="nofollow noreferrer">http://www.johnath.com/beep/beep.c</a> for another source (it's the same code, I believe).</p> <p>It allows you to control frequency, length and repetitions (among other things) with ease.</p> <p>To actually get it to work, you'll need a script which starts your actual <em>worker</em> program in the background, then goes into a <code>"sleep 60"</code> loop, beeping until it finishes.</p> <p>The following script should be a good start. You run it with something like:</p> <pre><code>beeper sleep 3600 </code></pre> <p>and it runs the <code>sleep 3600</code> in the background, beeping every minute until it finishes.</p> <pre><code>#!/bin/bash $* &amp; pid=$! oldmin=$(date +%M) exf=$pid while [[ $exf == $pid ]] ; do min=$(date +%M) if [[ $oldmin != $min ]] ; then beep oldmin=$min fi exf="$(ps -ef | awk '{print $2}' | grep $pid)" sleep 2 done </code></pre> <p>This is how it works. It runs the arguments as a background process and saves the process ID. Then it loops every couple of seconds, checking for when the minute changes and beeping when that's the case (so the first beep here may be anything up to a minute).</p> <p>The exit from the loop happens when the process disappears from the output of <code>ps</code>.</p> <p>You can even do beeper sleep 3600 &amp; to put the whole lot in the background. To stop the beeping, either kill off the beeper process (if you want the work to continue without beeps) or kill of the worker process itself (which will stop both the work and the beeping).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload