Keith, I did what you said and it works fine. I just need to get it into cron so that it will be done every night. How would I accomplish this? Kcron keeps crashing so I need another way. Thanks, Tom On Wed, 2002-07-10 at 12:39, Keith Winston wrote:
Tom,
If you follow my directions in the post, it will be automated. First, create the bash script (those two lines that start with #!/bin/bash), save it in your home directory, edit your crontab to schedule it. From your sample, you want it to run at 17:45 every day. That's it.
Best Regards, Keith
On Wed, Jul 10, 2002 at 12:05:18PM -0700, Tom Nielsen wrote:
Thanks for the information. What I'm trying to do is to have my system automatically backup my files, such as you stated.
How can I have automate what you have written?
Tom
On Wed, 2002-07-10 at 11:21, Keith Winston wrote:
On Wed, Jul 10, 2002 at 10:57:42AM -0700, Tom Nielsen wrote:
I'm trying to create an entry into crontab so that I can backup files every night. I created a file that has the following:
/bin/sh 45 17 * * * /bin/tar /mnt/win/tom/backup /home/tom/act
I saved the above as 'backup'
You are doing some odd things here. Your backup shell script should not have cron statements in it. Also, that doesn't look like a valid tar command either. Try something like this in a text file:
#!/bin/bash tar czvf /home/tom/backupfile.tgz /mnt/win/tom/backup /home/tom/act
Save it as /home/tom/backup and make it executable with:
chmod u+x backup
That script will create a backupfile.tgz (compressed) file in your home directory with the contents of the two directories.
I then opened a console, su'd and typed:
crontab -u root backup
The response is "You (root) are not allowed to use this program (crontab) Contact your sysadmin to change /var/spool/cronallow or /var/spool/crondeny"
You would only use the -u option if you wanted to edit the crontab of a user _other_ than the currently logged in user. By the way, you don't have to run this as a root cron (unless you don't have access to one of the directories you are trying to backup as a user). Try:
crontab -e
This will bring up a vi session where you can edit the crontab. Then, insert your cron command:
45 17 * * * /home/tom/backup
Save and exit. That will install your new crontab.
-- Tom Nielsen Neuro Logic Systems 805.389.5435 x18 www.neuro-logic.com