*

Welcome, Guest. Please login or register.

Get your own OLPC - Buy an XO laptop on eBay!
Pages: [1]
Print
Author Topic: crontab  (Read 4736 times)

crontab

metal.lunchbox
Senior Contributor
**
Posts: 149


May 28, 2008, 08:06:53 PM

I'm having trouble figuring out how to get crontab to work. I wanted to use my olpc as an alarm clock and wrote a simple shell script to set the volume to maximum and then open an mp3 file in xmms. The script itself works just fine when invoked from the command line. when I open up my crontab and insert the folowing nothing ever happens:

* * * * * /usr/local/bin/alarm

I set it to execute the alarm script every minute just to test it but even if i wait 30 minutes nothig happens. I've done this as root and as olpc user. why does this not work? I've used crontab before without problem just cant get it to work on my olpc. any help is much appreciated.
Logged

xoxoxoxoxo

#1 Re: crontab

teapot
OLPC News Forum Expert
****
Posts: 662



WWW
May 28, 2008, 08:24:51 PM

#!/bin/bash
export DISPLAY=:0

(the rest of your script)
Logged

#2 Re: crontab

markhadman
Senior Contributor
**
Posts: 112


May 29, 2008, 03:52:46 PM

Is cron installed? I don't think it was there by default on my machine (656). There was something called anacron.
Logged

#3 using crontab to make a simple alarm

metal.lunchbox
Senior Contributor
**
Posts: 149


May 31, 2008, 05:16:01 PM

thanks teapot, the line "export DISPLAY=:0" fixed it for some reason. that or i just mispelled something the first few times around.

if any of you are intested below is the script i used. it sets the volume to maximum and plays an mp3 file in xmms. nothing complicated

Code:
#!/bin/sh
export DISPLAY=:0

#####################################
##                                 ##
## Alarm clock script for crontab  ##
##                                 ##
#####################################

##set volume to deafening
amixer set Master 31

##use xmms to play song
/usr/bin/xmms /home/olpc/music/song.mp3

save that as /usr/local/bin/alarm and go to terminal and type "crontab -e" which will edit the crontab in Vim. press " i " to insert text and type " 45 6 * * 1-5 /usr/local/bin/alarm ". this will activate the alarm every weekday at 6:45am. then just pres esc., shift + Q, then wq and you're done
« Last Edit: June 20, 2008, 06:02:03 PM by metal.lunchbox » Logged

xoxoxoxoxo
Pages: [1]
Print
Jump to:  

Members
Total Members: 2405
Latest: sembik
Stats
Total Posts: 31943
Total Topics: 3843
Online Today: 48
Online Ever: 238
(April 18, 2011, 09:48:50 PM)
Users Online
Users: 0
Guests: 13
Total: 13