cron alarm clock

iknownotwhoiam

Registered
i have my crontab set up to wake me up every morning by playing a song in iTunes. the only problem is i have to manually set which song i want it to play every night. is there any way that i can get cron to randomly pick a file to play from a list i have generated, such as read a file and pick one? if so, could someone please fill me in on how to do this. thanks.
 

lethe

Registered
what do you have in crontab? open song.mp3?

why don t you create a small applescript file that launches iTunes and starts playing at random, and put 'open applescript' in crontab
 

scruffy

Notorious Olive Counter
also check versiontracker for "MP3 Alarm Clock". Nice little app, featureful and free.
 

Koelling

I Think Different
I'm confused, can some one help me out?

Where does this code stuff go? I know the CLI fairly well but I don't know scripts very well. obviously I can't just enter "perl -e 'print "$ARGV[ int rand( scalar( @ARGV ) ) ]\n";' /path/to/mp3/*" into cronnix so how do I make it work? Sorry if this is overly easy but the thread kinda jumped in above my head.
 

BSDimwit

Registered
crontab file...

type crontab -e (this will open you crontab file for editing)

then, depending on what time you want it to go off, you set the time like so

0 7 * * * /Users/yourname/scriptsdir/alarm.pl

Basically, you all the other stuff the other guys told you, would go into a script called alarm.pl, and the cron daemon will run it at 7am or whatever time you set it for. For more info on crontab do a man crontab... with that you should be able to figure out how to start stuff up at designated times.

Hope this answers your question.
 

Koelling

I Think Different
Thanks :) I have used it just crontab -e before but I'm not entirely proficient in it so I use cronnix which does the same job, just cocoaized. And that part about alarm.pl is exactly what I wanted to know.
 
Top