LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 12:50 PM   #16
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

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 12:53 PM.
 
Old 11-23-2006, 09:19 PM   #17
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 02: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, 05:05 AM   #19
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
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, 10:46 AM   #20
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

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, 06:46 AM   #21
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

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, 12:27 PM   #22
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 01:48 PM   #23
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

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, 02: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, 04:24 AM   #25
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

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



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-03-2005 11:08 PM
Recording Audio-in Dirk the Daring Linux - General 0 12-23-2004 10:43 AM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 04:51 PM
need help recording audio havokok Linux - Software 0 03-03-2004 07:41 PM
Recording audio with linux karim Linux - Software 0 10-06-2003 07:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:20 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
Open Source Consulting | Domain Registration