LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   simple cron job: not working (https://www.linuxquestions.org/questions/linux-software-2/simple-cron-job-not-working-110685/)

Robert0380 10-30-2003 11:42 PM

simple cron job: not working
 
I wrote a scrpit that plays a song (an MP3)

Code:

#!/bin/bash
                                                                                                                           
/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:

Code:

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).

Code:

*/5 * * * * ....(same as above)
i get this in my syslog ( /var/log/messages)
Code:

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).

Robert0380 10-30-2003 11:44 PM

extra note, the script and mp3 file are owned by user "robert" and the script is set to run as user "robert" not root..

DrAxeman 09-09-2006 11:30 AM

Just thinking aloud:

Who's cron are you running it from? Your's or root's?

blue_hunter 06-24-2008 04:45 AM

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".


All times are GMT -5. The time now is 02:17 AM.