Archive for category server
Automatic Backup With Rsync And Cron On Ubuntu
Keeping a directory automatically backed up somewhere is always useful. Every few months this is needed on one machine or another. Here are the steps:
- First set up ssh keys so passwords are no longer needed.
- Test things by verifying a ’ssh user@yourserver.com’ does require a password.
- Make some ssh keys on your client and then move the public key to the server
- cd ~/.ssh
- ls
- ssh-keygen -t dsa (Keep the defaults by just pressing enter a few times.)
- scp id_dsa.pub user@yoursever.com:.ssh/
- Now set things right on the server
- ssh user@yourserver.com
- cd ~/.ssh
- cat id_dsa.pub >> authorized_keys
- rm id_dsa.pub
- exit
- Test things by verifying a ’ssh user@yourserver.com’ no longer requires a password.
- Determine the directory to be backed up and where it will be backed up and test the command to be used.
- time rsync -atvz ~/local-directory-of-your-choosing/ user@youserver.com:remote-directory-of-your-choosing/
- log in the server and verify the files are there…
- Put the command in cron. Because cron is broken in ubuntu you can’t simply do “crontab -e” anylonger. (How can something so basic be broken?!) Instead follow these instructions:
- vi ~/some_file and put in the cron commands
- @hourly rsync -atvz ~/local-directory-of-your-choosing/ user@youserver.com:remote-directory-of-your-choosing/
- crontab ~/some_file
- crontab -l
Now simply test it out…
Sumber :
http://ioconnor.wordpress.com/2009/07/25/automatic-backup-with-rsync-and-cron-on-ubuntu/
Membuat startup scripts on ubuntu
untuk membuat skrip yang akan di load otomatos saat start up pada ubuntu:
- buatlah script yang anda butuhkan, dan pastikan script tersebut di awali dengan “#!/bin/bash“.
- Buat script tersebut executable, dengan perintah “sudo chmod +x <nama file>“
- kopikan script tersebut ke “/etc/init.d./“
- langkah terakhir jalankan update-rc.d dengan command, “sudo update-rc.d <nama filr> defaults“.
untuk membuang file agar tidak di jalankan saat booting:
- delet file tersebut, “sudo rm /etc/init.d/nama_file“
- kemudian jalan kan perintah “sudo update-rc.d <fnama_file> remove“
Lihat videonya disini.
salam
Ardlian

