I would like to use audio-recorder for recording. It should start recording at a certain time and stop after hours.
1 Answers
I suppose you're talking about this software, however it does provide only very limited command-line options. If you want to record audio from command-line or in a script you better stick to command-line programs – I'm essentially using this approach here. For this to work you might need to install some packages, run sudo apt install pulseaudio-utils lame
to be sure.
#!/bin/bash
sink="alsa_output.pci-0000_00_1b.0.analog-stereo"
echo 'f=$(date +%F_%R)_rec.mp3;timeout "'$2'" parec -d "'$sink'".monitor|lame -r -V0 - $f'|
at "$1"
You need to adjust the value of sink
to your system, pacmd list-sinks|grep name:
shows it enclosed in <>
(don't copy those!). After that make the script executable with chmod +x SCRIPTNAME
and run it as e.g. /path/to/SCRIPTNAME 10pm 30m
to record for 30 minutes starting at 10pm. The recording will be saved in the directory where you run the script as e.g. 2017-12-17_10:00_rec.mp3
for a recording that started at this date and time. If you want to change that, replace $(date +%F_%R)_rec.mp3
in the script.
Example run
$ ./test.sh 10:00 10m
warning: commands will be executed using /bin/sh
job 1 at Sun Dec 17 10:00:00 2017
$ atq
1 Sun Dec 17 10:00:00 2017 a dessert
$ atrm 1
$ atq
$
As you can see, you can use atq
to display and atrm
to remove a pending job.
Time and duration format
As for the time format see man at
, especially:
At (…) accepts times of the form HH:MM to run a job at a specific time of day. (If that time is already past, the next day is assumed.) You may also specify midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDD[CC]YY, MM/DD/[CC]YY, DD.MM.[CC]YY or [CC]YY-MM-DD. The specification of a date must follow the specification of the time of day. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow.
As for the duration format see man timeout
, especially:
DURATION is a floating point number with an optional suffix: 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days.

- 39,982
man at
. Please [edit] and clarify: What did you try? What behaviour did you experience? What's wrong? – dessert Dec 16 '17 at 22:08