LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2014, 08:25 PM   #1
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Rep: Reputation: 24
Cron problems


I'm still trying to nail down the problem and hopefully someone can help me.

When I run my code from the terminal, it works. When it is run from Cron, there is no recording. The file is created but when I open it, nothing. No sound, and the file size stays at 44k. When I run from the terminal, I can see the file size increasing when I look at it from a thunar window.

Any idea what is going on and what I should do?

This is the code I am using:

Code:
arecord -t wav -f cd -d 44 /home/randy/chuo-radio-shows/testaudioJUN0514.wav
Here is the crontab entry :

Code:
 
9 11 * * 4 arecord -t wav -f cd -d 44 /home/randy/chuo-radio-shows/testaudioJUN0514.wav

I am using LinuxLite 2.0 which is based on Ubuntu 14.04
 
Old 06-05-2014, 08:30 PM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Tried using full path to arecord?
 
Old 06-05-2014, 11:59 PM   #3
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 273Reputation: 273Reputation: 273
Usually when a command works from the terminal but not from cron, it needs to specify the full path.
Because environment variables for cron is different from those about your user.

Last edited by kooru; 06-06-2014 at 12:01 AM.
 
Old 06-06-2014, 05:07 AM   #4
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
Haven't tried that.Will see if that resolves my problem. What does the full path look like? Thanks!!
 
Old 06-06-2014, 05:20 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,516

Rep: Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436
full path means you start it with a slash / and will point to the file you want to execute. For example ls is located in /bin, therefore it is /bin/ls using full path. Also man is located in /usr/bin, it will be /usr/bin/man.
So execute the command which arecord, that will show you the full path to arecord and use that in your crontab:
9 11 * * 4 /full/path/to/arecord -t wav -f cd -d 44 /home/randy/chuo-radio-shows/testaudioJUN0514.wav
 
Old 06-06-2014, 05:28 AM   #6
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
So it is the full path to arecord? That's interesting. I thought you meant full path to the .wav file which I already used. Thanks for this info!!

I will post back with my results. I learned something new. Thanks again!
 
Old 06-06-2014, 07:26 PM   #7
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
The echo command below prints your user environment path.
Code:
~ $ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2:/usr/games/bin
You can see if you are in your user environment the arecord is in your path, so it will be found even if you do not specify full path.
Code:
~ $ which arecord
/usr/bin/arecord
OTOH, cronjob does not run in your user environment (it does not log in as you), thus plain arecord will not be found.
 
Old 06-07-2014, 09:01 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
I suspect the full path won't help - after all, the output file wouldn't be created if it didn't run.

What I think is happening is that arecord doesn't have access to the audio source, thus getting either an EOF and exiting, or creating an error message.

Audio device access isn't something that cron would enable.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Cron directories: /var/spool/cron/cron.GfqqGO Woodsman Slackware 4 05-11-2011 03:37 PM
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 09:57 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM


All times are GMT -5. The time now is 11:04 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration