Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been searching of the forum for a task scheduler and I came across posts on cron. I just started using linux about 2 weeks ago and on Windows before I would schedule and mp3 every morning at 7am to wake me up. I'm not sure how to set this up I think use crontabs -e or something of that nature. Say the mp3 is in /usr/music , how would I exec this mp3 every morning? Thanks for the help.
Ok, now that makes sense, I wasn't sure if you had to specify a program for it to run also. How do I go about editing that. Crontab -e brings up the text and 4 demos it looks like but I can't type, how can I edit it? Thank you
Theres nothing in that log. Is this crontab like a dummy one? Would I have to create an entire new one? .... like when I do crontab -e I get
Code:
# If you don't want the output of a cron job mailed to you, you have to direct
# any output to /dev/null. We'll do this here since these jobs should run
# properly on a newly installed system, but if they don't the average newbie
# might get quite perplexed about getting strange mail every 5 minutes. :^)
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don't need greater granularity than this. If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
56 12 * * * /usr/bin/xmms /usr/music/Answers.mp3 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
Is that right? or am I being stupid? Thank you for your help so far. I don't want to have to reboot to windows just for an alarm.
Originally posted by ex0r I don't get it, not even $at is working for me....
Well I just tried executing just the program XMMS and it sent mail saying
CRITICAL : Unable to open display
I'm still not sure how to get cron to work but thank you Demon for all your help.
Thats most likely your problem, XMMS is a GUI application. Are you running the cron as the user who's started X? Or are you running the cron as maybe root logged in as another user in X? More details? Can you run the program using a CLI mp3 player with any problems?
You shouldn't try to run a X program from cron,
really ... use mymp3 or mpg321 or something...
Firing up something in X makes it unnecessarily
complicated...
Well yeah, I'm logged into root, I really don't use users... nor do I really know how to make any or do it, like I said I've been using linux for not long, is it not good to be logged into root? Do you think thats my problem?
It's certainly not recommended to be
logged in as root all the time. One reason
is security, the other is safety :} ... as root
you can do SO much damage to your system.
The problem you're running into is that
cron or at are running as daemons in the
background. They don't know diddly-squat
about X ... and the shell they're running on
doesn't have a DISPLAY environment variable
set ...
My recommendation really would be to
a) create a user account for everyday use
and
b) use a command-line player for the alarm ;)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.