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.
Ok, please I apologize in advance for my complete dumbness. I havent ever dealt with Linux before, so this whole thing is like complete greek to me.
I have a website that frequently relies on cron jobs to complete tasks. On our old hoster, I had the "Cron Manager" in the administrative suite. Unfortunately we've outgrown that hosting plan, and now moved to a VDS server. So I'm in a world I dont know. I asked my hoster how to create cron jobs and he stated I could use putty.
So, heres how far I got.
I downloaded putty and was able to connect via SSH to my website. If I type in any cron command (as I was trying to do this myself by google first) nothing happens. Im not sure if I have to be in a specific file, or what. Im so so confused.
I can post any other information that might be able to help me, but how to get that crontab command to work would be great. (Do I need to login a certain way, have certain permissions set, be in a certain folder?) That'd probably help immensly.
Again, Im so sorry for being a total Linux noob. Thanks in advance for any help!
I guess thats where Im getting confused. If I just log into putty and start at the prompt I start at and type crontab -l or crontab -e nothing happens. It just goes to the next line prompt. So Im wondering if I have to be in a certain file to view/execute crontab commands? I was able to check where the users and deny lists would be and there is none on my site.
To use cron, you will need to edit the file /var/spool/cron/h321760w and then type the command crontab at the SSH prompt. We do not provide any technical support for problems with cron, but it does work just fine.
So I do have that file, and I am able to edit it. What do I put in that file though? Say I have a php cron called cron.php I want to run every minute (just for example to get the hang of this).
Thank you all so much for the help!
EDITED TO ADD:
I did try to figure this out myself and I put this in the file:
(With the mailto just to see if it works I really dont need that - and yes to my email I just edited it out :-P)
If I type in crontab at the command prompt it tells me bad minute? *confused* Am I even anywhere near the right track here? LOL Thanks again for the help!
EDITED AGAIN:
Heres the exact error message:
Quote:
bad minute
errors in crontab file, can't install.
Failed to update crontab
Last edited by jmrothermel; 12-10-2008 at 08:34 AM.
Ok I had a small breakthrough! YAYYYYYYYYYYYYYYY (LOL Im a dork )
So if I go into my SSH and type /var/www/html/cron.php the sql query that I have in the file executes (Which just for testing purposes is as below
Code:
#!/usr/bin/php -q
<?include("config.php");
$update = mysql_query("UPDATE `test` SET `test`='5' WHERE `id`='1'");
?>
So I know the cron can and does work. Now, what/where/how do I edit that stupid /var/spool/cron/h321760w file and what do I put in it? I tried editing it with my file editor to just reflect the cron ( * * * * * /var/www/html/66.84.26.31/crontest.php ) But alas that didnt work. Do I edit it through SSH with Putty?
Im so close Im finally not sitting here on the verge of tears. I just need to figure this last key out. I dont know if it helps, but Im on a VDS server which I guess is why the crontab -e didnt work? THANK YOU!
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370
Rep:
Your first try in post #5 failed since the only content allowed in a crontab file is a comment which begins with a "#" or a line which contains a 7 field crontab entry in the following format:
Code:
#"minute" "hour" "day of month" "month" "day of week" "user" "command(s)"
* * * * * jmrothermel /var/www/html/66.84.26.31/crontest.php
Your last post only had 6 fields in the crontab entry.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.