Categories:
-
3d 96 articles
-
animations 16 articles
-
architecture 47 articles
-
blender 98 articles
-
bédé 19 articles
-
techdrawing 24 articles
-
freecad 190 articles
-
gaming 1 articles
-
idsampa 8 articles
-
inthepress 8 articles
-
linux 57 articles
-
music 1 articles
-
nativeifc 31 articles
-
opensource 267 articles
-
orange 4 articles
-
photo 16 articles
-
projects 35 articles
-
receitas 176 articles
-
saopaulo 18 articles
-
sketches 163 articles
-
talks 25 articles
-
techdrawing 24 articles
-
textes 7 articles
-
trilhas 3 articles
-
urbanoids 1 articles
-
video 47 articles
-
webdesign 7 articles
-
works 151 articles
Archives:
-
2007 22 articles
-
2008 32 articles
-
2009 66 articles
-
2010 74 articles
-
2011 74 articles
-
2012 47 articles
-
2013 31 articles
-
2014 38 articles
-
2015 28 articles
-
2016 36 articles
-
2017 41 articles
-
2018 46 articles
-
2019 59 articles
-
2020 18 articles
-
2021 20 articles
-
2022 7 articles
-
2023 25 articles
-
2024 15 articles
A simple backup script
I use this script at home to create a mirror effect between 2 machines, every hour the contents of a given folder on machine A get synced to a same folder on machine B. For our little 2-machine workplace, this is a pretty handy backup system. You must first setup your fstab so that you can mount a remote folder as normal user, adding something like this (changing "credential-file" by the path to your credentials file):
//192.168.0.2/backup/ /media/backup cifs credentials=credentials-file,uid=1000,gid=1002,rw,user,noauto 0 0
Then, save this in your exec path and make it executable:
#!/bin/shumount /media/backupif mount /media/backup; then echo "network drive mounted, performing backup... " rsync -rtvx --delete /path/to/my/Worksfolder /media/backup umount /media/backup logger works backup done echo "unmounting... done"else echo "backup failed" logger works backup failedfi
The logger line inserts the text that follows into the syslog, which is useful so you can check later if something went wrong and when. Then, add this to your crontab (using "crontab -e"):
00 * * * * /home/yorik/bin/backup
Which means "run each minute 00" which means run every hour.
Read next:
Hi,:
Hi,