Help - Search - Members - Calendar
Full Version: commands used for "cron jobs"
The Planet Forums > Operating Systems > Red Hat Linux > Red Hat HOWTOs
akt
hello everyone,
I have a question related cron, crontab etc...
i was just wondering that how can one set a cron to a specific user ie i have a website xx1@xx.com with a user for the website xx.
Now i want a cron to be set to take a daily,weekly or monthly backup for the same....(mine os is RH9 with cpanel/whm with the latest stable built 9.4).....
I was just wondering can any body tell me what are all the COMMNANDS that i shall use to complete the cron....
Also What is the command used to see the latest uptodate backup taken for the same earlier..and where can i find the dates i know one is the /etc/dumpdates but i don't see any such file...

PLease help me
Thank You all out there.....
icon_smile.gif
jetson
Hi, hopefully you've got this down by now, but since there were no replies I figured I'd chime in with my cents. This has nothing to do with cpanel/whm or any other panel, just login ssh, but unless `the panel` changes the way crontab works it should make no matter.

The easiest way to run cron jobs for the system is to simply copy the script you want to run into the appropriate /etc/cron.*** folder, so if you wanted your script to run every hour, copy your script to /etc/cron.hourly

This would allow you to run every script in the cron.*** directory at the interval specified by the *** in cron.*** (hourly,daily etc)

Using this method you could literally perform any action you need to, you could back up all of your sites, ftp/move/send them wherever you want, email your dog a photo of your cat, but I havent figured out how to make large deposits in my bank account every hour yet.

For a specific user, as far as I know there needs to be a system account for that user, then when logged in or su -'d as that user you can simply pass the -u option to crontab. So if you wanted to add/edit/update the crontab for a user named butcheek, and your logged in as another user

su - butcheek

[will have to enter password if your not root etc]

crontab -u -e

this will start the editor for the crontab

now for the syntax of it all, I recommend you read up.

`man crontab` may do if your comfortable with that, a quick search on google for `crontab` gave me http://www.unixgeeks.org/security/newbie/u...nix/cron-1.html as the first result, which looks like a good start.

As with anything like this, I'd say

1) Do your learning / testing on a system other than your server, I personally try and keep a "mirror" system at home for backups and development, which also happens to give me an excuse not to throw away my old pc's, lol, Linux is cool like that I giess........

2) start small. Theres no need to make it hard diving into two new? things at once, learn how things work, write a simple script/crontab that does something you already know how to do, or mails you the date or something. Once you've got that working you can move toward working out the best way to do what you want with what you got, if you want!

Hope you or someone else finds this useful, I know there were others who read your post and could've offerred something more, but didnt offer anything, probably because they were busy signing up with the Christian Childrens Fund for only 32 cents per day, or maybe it's just their form of payback for not getting picked to play kickball as a child, who knows. .......
akt
Hello,
Thank So much to give me the knowledge for the cron and crontab stuff......
really apprichate the same....

its really pleasure posting queries on this forum...

thank you.....
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.