Cron job to backup
Hi,
Expert please help me. I use Ubuntu Server and I only wish to create a cron job everyday at 3AM to backup my directory /home/ and tar it, and add password "LINUXRULEZ" to it, then FTP it to ftp.linuxrulez.com using username LINUX password RULEZ Can you help me please? |
try it your self when you are in between and have problems then ask every one to get you one step above.
|
heh heh, the problem is, i'm only 10 years old and don't really understand still after I read some articles on it. Can you help a 10 year old ples?
|
well then get elder and then try Linux, but while learning don't use feeder.
|
why are you so mean -.- pakistan
|
Quote:
This is not quite the attitude we would like the OP to think we at LQ have, regarding young people using Linux. If you cannot offer constructive help, kindly at least allow others to do so. Sasha |
well dear moderator
I din't stop any one to help some one, I am also learning. but do you think that he can be answerd for every thing which he din't try yet. |
Quote:
|
Quote:
|
pls help me, i am trying to back up my homework which is stored in /home/
|
Hi prudens,
Ok, I will suggest a first step that you should take: First, read the manual pages (the help pages) for the `cron` tool, and for the `tar` command. You can read this documentation by using a command as follows, from your console: Code:
shell$ man crond Also, the `tar` man page should give good detail of using tar and gzip to archive your /home folder. After doing a bit of reading there, show us what you have come up with as far as the crontab settings for the job, and what command you think you need to archive the /home folder. We'll see what you've got, and advise from there. Personally, I'm not too experienced with the ftp aspect of your request, so someone will help or offer ideas for that part later. Sasha |
Hello prudens (wise one) :)
Have you decided what language to use? Bash shellscript is suitable and easy to debug. The easiest way to approach software development like this is to take it in bite-sized chunks and do each step manually, for familiarisation, before linking them all together in a script. You could start by doing the tar and FTP parts at the command line. Man pages are good references but not the easiest introduction. I've been using *n*x systems a while and I still go looking for examples (HOWTOs and FAQs) on the Internet if the man page does not make sense straight away. Here's a page exampling tar. There are lots of FTP HOWTOs and FAQs so Google for FTP HOWTO or FAQ and pick the one you get on best with. The environment your script will eventually run in, set up by cron, is different from the login environment and this often causes breakage. In particular, the $PATH variable is different so safest to use full paths for your commands, example /usr/bin/ftp rather than ftp. You may also like to include a date in your tar archive (output) file name so you can store several on ftp.linuxrulez.com. That way, if you find you want a file that was deleted a while ago you can get an old tar archive and restore it. When you come to scripting the FTP put (upload) you will probably want something like Code:
ftp $host_name <put_script>> put_out 2>&1 When (if?) you get stuck or want feedback on whether you are doing things the best way, post what you've done here. It's easier to read your stuff if you put it in CODE tags, that's the word CODE in brackets [] to begin and /CODE in brackets to end. Looking ahead to when you've got it working I strongly recommend that you also get your backup file from ftp.linuxrulez.com and test that it can be used to restore files; many people have only found out that their backups don't work when they try to restore from them! Finally, your backup script may fail; if it writes a log and you can discipline yourself to check it regularly then you will avoid the danger of thinking the backup is working until you need to restore something and find the script wasn't working for the last few months! Best Charles |
ooo thank you guys very much for going in great depth! I'll spend the next few days reading and learning from you guys hahahaa.
|
Here's a good example of how to use cron.
http://www.adminschoice.com/docs/cro...Crontab%20file I hope that your target is not on the net as you've given the user/passwd combo. You should change that. |
Very good english for a 10 year old boy from Pakistan. And very busy with his homework, if he needs to have it backed up everyday at 3AM. Is this the usual amount of homework for children at that region, or is the poster playing games with this forum?
Linux |
All times are GMT -5. The time now is 02:43 PM. |