2007年7月11日 星期三

Set up an mp3 alarm on CentOS

1. Make sure the user who will run the alarm is not in /etc/cron.deny
2. Log in as the user then type crontab -e for editing his cron entry
# dom = Day of Month
# dow = Day of Week
# m h dom mon dow command
42 07 * * 1-5 /usr/local/bin/alarm

3. vi /usr/local/bin/alarm


# run xterm to execute mplayer in another window
# with the parameter, display 0 you can quit playing easily,
# the parameter -loop 0 means repeat forever.
/usr/bin/xterm -display :0 -bg black -fg white \
-e /usr/local/mplayer -loop 0 filename.mp3



/usr/bin/mplayer -loop 0 filename.mp3

4. Remember to give permission of execution to alarm
chmod 7xx alarm

5. An easy way to stop playing, use the command pkill

pkill mplayer

沒有留言: