Crontab help!


#1

I really don’t understand how this works…

I have a file named “crontab” under my /home/user/ect directory, correct?

Ok then I built the inside:

  •   *       *       *       *    cp -u /home/user/domain/cgi-bin/ /home/user/domain/stats/
    

But why doesn’t that work? Shouldn’t it copy the content of stats into the cgi-bin? (Though this is just for testing, I would like to be able to move the content of stats for my massive stats program im working on…)


Use “DCOUNTME” promo code when registering and receive up to $85 off! (referer: saygoodbye)


#2

well, first off check out this Wiki Article. That will help some I suspect.

Your first problem is that just putting a file called cron in your home direcotry won’t do anything. You’ll need to type “crontab -e” to edit your crontab, or you could use “crontab filename” -replacing filename with an actual text file, to import that file as your crontab (and overwrite anything already there). If you’re editing the crontab then once you’re done you’re press ctrl-o to save the file and ctrl-x to exit. After either command is carried out you will (hopefully) get a success message about the new crontab being installed, or an error message.

Next, I don’t think that you really want your script to run that often… I’m not actually sure how often it will run they way you have have it set up, but it’s a lot. I tested to see if that was even a valid setting, and it was accecpted, but… Read the wiki article to understand how specifying the time works, and decided how often you really want it to run.

-Matttail


#3

Of course its not going to run every second… most likely that would kill the server load or something… but what do I use to enter these commands in I use winFTP (windows defualt ftp client), should I be using telnet?


Use “DCOUNTME” promo code when registering and receive up to $85 off! (referer: saygoodbye)


#4

ya, sorry you -you need to enter thoes from the command line on your server. SSH is the best way to do that (a secure version of telnet) pick up a program called putty.

Also, for ssh access, your user must allow that through the panel > Users > Manage Users > Edit > Tick mark for ssh access.

I think that using five * sets it to run once every minute. It’s not really a standard way of doing things, and I doubt that you need the file copied out that often anyways.

-Matttail


#5

Ok got Putty, my question now is how do I enter a cronjob? Im lost mostly because of the DH tutorial!


Use “DCOUNTME” promo code when registering and receive up to $85 off! (referer: saygoodbye)


#6

type:
crontab -e

That will bring up the efault text editor (nano) and then you can paste in your crontab line.
Once you’ve got it right, press ctrl and o at the same time, then ctrl and x. You will hopefully get a message like “successfully installed new crontab”.

-Matttail


#7

ok I think I have it! I have it running off a file, now if I update this file will the cronjob go witht he update or is it cached?


Use “DCOUNTME” promo code when registering and receive up to $85 off! (referer: saygoodbye)


#8

it will go with the update. (not cached)

-Matttail


#9

Alright then it still is not working…

1 * * * * cp -R /home/user/domain/statistics /home/user/logs/domain/http.1733358/html

Is my new command… any debugger?


Use “DCOUNTME” promo code when registering and receive up to $85 off! (referer: saygoodbye)


#10

well, to be sure I’d need to know what the error you’re getting is…

But I’m thinking you’re got the directories backwards. You command should reflect this:
cp -r /path/to/origional/file /path/to/new

Also, I assume you’ve just edited your command to protect privacy… but you are using the proper user name and domain folder, right? It may help to check your command by running it from the command line to see if it works, or what error you get. (just ditch the cron-timing part)

-Matttail


#11

I don’t need the cron timing part?

And yes im just trying to protect my privacy, so that should all be fine, my real problem now with the message is that my folders don’t have the right permissions, so I tried to change them via ftp, but it keeps failing to change the permissions…


Use “DCOUNTME” promo code when registering and receive up to $85 off! (referer: saygoodbye)