LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 11-23-2006, 01:50 PM   #16
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565
Blog Entries: 1

Original Poster
Rep: Reputation: 50

Quote:
Originally Posted by Tinkster
The hard part would be to stop the previous recording and make it save
the file with a given name. And the names suck, you can't sort those
chronologically, you should have YYYY-MM-DD-time.wav, not MM-DD-YYYY
(which is the most stupid convention anyone ever dreamt up :}).

Which software are you using for recording, anyway?
I'm using sound-recorder
So here is an example including you suggestion. Is it OK?
Quote:
00 02 1-31 1-12 0-6 sound-recorder -b 8 -c 1 -s 44100 -S 120:00 ~/audio/+%y-%m-%d-%k-%M.wav
How exactly do I format the +%y-%m-%d-%k-%M part so it does what I want? Or is it fine in it's current state?
BTW, maybe I schould put the command in a script so that I just have to modify the script if I need the command to change, right?

Last edited by ctkroeker; 11-23-2006 at 01:53 PM.
 
Old 11-23-2006, 10:19 PM   #17
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by ctkroeker
I'm using sound-recorder
So here is an example including you suggestion. Is it OK?

How exactly do I format the +%y-%m-%d-%k-%M part so it does what I want? Or is it fine in it's current state?
BTW, maybe I schould put the command in a script so that I just have to modify the script if I need the command to change, right?
Code:
0 */2 * * *  /path/to/sound-recorder -b 8 -c 1 -s 44100 -S 120:00 ~/audio/`date "+%y%m%d-%k-%M"`.wav
should do.... chances are that sound-recorder isn't in the PATH of
cron, so a full path-name could be required.


Cheers,
Tink
 
Old 11-24-2006, 03:28 AM   #18
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Just a minor detail, but for YYYY, you'll need %Y (instead of %y) in the "date" format.
 
Old 11-24-2006, 06:05 AM   #19
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,176
Blog Entries: 4

Rep: Reputation: 430Reputation: 430Reputation: 430Reputation: 430Reputation: 430
I have merged both your threads to keep the discussion in one place and to help people not to duplicate their ideas.
 
Old 11-24-2006, 11:46 AM   #20
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565
Blog Entries: 1

Original Poster
Rep: Reputation: 50
OK, got it going. Just in case someone wants to know how I did it:
Here is my crontab ( I realize I could make it simpler, i.e: putting */2 by the hour entry, but I wanna be able to set stuff every two hours if I want to)
Quote:
#min hr dom mon dow cmd
* 0 * * * sh /home/server/.scripts/aircheck.sh
* 2 * * * sh /home/server/.scripts/aircheck.sh
* 4 * * * sh /home/server/.scripts/aircheck.sh
* 6 * * * sh /home/server/.scripts/aircheck.sh
* 8 * * * sh /home/server/.scripts/aircheck.sh
* 10 * * * sh /home/server/.scripts/aircheck.sh
* 12 * * * sh /home/server/.scripts/aircheck.sh
* 14 * * * sh /home/server/.scripts/aircheck.sh
* 16 * * * sh /home/server/.scripts/aircheck.sh
* 18 * * * sh /home/server/.scripts/aircheck.sh
* 20 * * * sh /home/server/.scripts/aircheck.sh
* 22 * * * sh /home/server/.scripts/aircheck.sh
and here is the aircheck.sh script it refers to:
Quote:
#!/bin/sh
#
/usr/bin/sound-recorder -b 8 -c 1 -S 119:59 ~/audio/$(date +%Y-%m-%d-%T).wav
Works great. The %T value in the filename puts in the exact time, resulting in a filename like this:
2006-11-24-13:42:45.wav

Thanks everyone for your input.
 
Old 11-25-2006, 07:46 AM   #21
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565
Blog Entries: 1

Original Poster
Rep: Reputation: 50
OK, I'm having trouble. WHen cron starts on the hour, it records fine, but after arrounf 5 min. it stops, terminating the script. Any idea what I'm doing wrong?

crontab -l
Quote:
# m hr dom mon dow command
0 */1 * * * sh /home/server/.scripts/cron_job
/home/server/.scripts/cron_job
Quote:
#!/bin/sh
/usr/bin/sound-recorder -b 8 -c 1 -s 22050 -S 59:59 /home/server/audio/$(date +%Y-%m-%d-%T).wav
/var/log/syslog
Quote:
Nov 25 09:01:01 ubuntu /USR/SBIN/CRON[23238]: (server) CMD (sh /home/server/.scripts/cron_job)
Nov 25 09:01:01 ubuntu /USR/SBIN/CRON[23235]: (server) MAIL (mailed 119 bytes of output but got status 0x0001 )
Nov 25 09:08:11 192.168.0.248 -- MARK --
 
Old 11-25-2006, 01:27 PM   #22
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Try explicitly back-grounding the script? I've never seen cron terminating
any of my (even longer-running) scripts after a time. Does your recording
software have some flag for producing debug-output?


Cheers,
Tink
 
Old 11-25-2006, 02:48 PM   #23
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565
Blog Entries: 1

Original Poster
Rep: Reputation: 50
Till now, the script always produced a 6.8MB file and terminated.
I tried running the script manually and it worked the way it's supposed to. Then I re-read this whole thread and thought that maybe I schould put in the number of seconds it was supposed to record instead of mins. into the script. Now it records double the time and stops again at double the size.
Quote:
#!/bin/sh
/usr/bin/sound-recorder -A /dev/dsp -c 1 -s 22050 -S 3600 ~/audio/$(date +%Y-%m-%d-%T).wav
BTW, there is no option for debug output in sound-recorder.
BTW 2, I tried arecord but it always gives me a error:
Quote:
server@ubuntu:~$ arecord -D /dev/dsp0
ALSA lib pcm.c:2143snd_pcm_open_noupdate) Unknown PCM /dev/dsp0
arecord: main:547: audio open error: No such file or directory
This is getting quite frustrating...
 
Old 11-27-2006, 03:27 AM   #24
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Again, just a small detail:
*/1 for the hour setting doesn't make much sense. Replace it by *, just to be sure.
Think of the "/n" operator as "any value that is divisible by n". Since all values are divisible by 1,
/1 can always be omitted. The 0 for the minutes will make sure it runs only once per hour.

Your problem most likely isn't caused by this, though.
 
Old 11-27-2006, 05:24 AM   #25
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565
Blog Entries: 1

Original Poster
Rep: Reputation: 50
Tried all of that already to no effect. This is drving me nuts and I really want it soon.
 
  


Reply

Tags
cronjobs, recording


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Recording. svendabassist Linux - Software 1 02-04-2005 12:08 AM
Recording Audio-in Dirk the Daring Linux - General 0 12-23-2004 11:43 AM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 05:51 PM
need help recording audio havokok Linux - Software 0 03-03-2004 08:41 PM
Recording audio with linux karim Linux - Software 0 10-06-2003 08:40 AM


All times are GMT -5. The time now is 04:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration