Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-31-2003, 12:42 AM   #1
LQ Guru
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
simple cron job: not working

I wrote a scrpit that plays a song (an MP3)

/usr/bin/mpg123 /home/robert/wakeup.mp3
very simple script, almost pointless to have the script but it's there and it works

i made a cron job to run this script at 8 am every day:

0 8 * * *  robert  /home/robert/alarm > /dev/null 2>&1
i ran the /home/robert/alarm > /dev/null 2>&1 and it plays the song and
doesnt output all the extra text that comes with runnign mpg123.

now, i decided to make a cron job to run this every 5 minutes so i could test it
out now (to see if it works).

*/5 * * * * ....(same as above)
i get this in my syslog ( /var/log/messages)
Oct 31 00:30:00 decatur CRON[5523]: (robert) CMD (/home/robert/alarm > /dev/null 2>&1)
Oct 31 00:30:00 decatur CRON[5524]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
Oct 31 00:35:00 decatur CRON[5542]: (robert) CMD (/home/robert/alarm > /dev/null 2>&1)
Oct 31 00:40:00 decatur CRON[5550]: (robert) CMD (/home/robert/alarm > /dev/null 2>&1)
but i hear no music. it works fine in the console but nada when cron plays it.

The goal is to use my computer as my alarm clock

im using Vixie cron in Gentoo (vcron).

Last edited by Robert0380; 10-31-2003 at 12:45 AM.
Old 10-31-2003, 12:44 AM   #2
LQ Guru
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Original Poster
Rep: Reputation: 47
extra note, the script and mp3 file are owned by user "robert" and the script is set to run as user "robert" not root..
Old 09-09-2006, 12:30 PM   #3
Registered: Jun 2004
Location: State of Confusion
Distribution: My other OS is your Solaris box.
Posts: 84

Rep: Reputation: 15
Just thinking aloud:

Who's cron are you running it from? Your's or root's?
Old 06-24-2008, 05:45 AM   #4
LQ Newbie
Registered: Jun 2008
Posts: 1

Rep: Reputation: 0
hi, don't use mpg123 to play the music, please use mpg321 instead....
mpg123 got no problem with playing sound in console, but when come to cronjob, you need mpg321 to play it .. and set the process to "quiet".


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
cron job suddenly stopped working Gisli Linux - Software 1 08-25-2005 01:03 PM
how to make a simple code for just restarting Apache via a Cron job hsa Programming 1 08-22-2005 05:15 AM
GPG cron job not working michredhat Linux - Software 1 12-07-2004 11:27 PM
cron job working2hard Programming 6 07-28-2004 10:12 PM
cron job thesnaggle Linux - Newbie 1 09-19-2003 11:47 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:57 PM.

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