Author Topic: auto backup samba profiles by ftp  (Read 599 times)

No Smile

  • Zen Apprentice
  • *
  • Posts: 17
  • Karma: +0/-0
  • meep* meep*
    • View Profile
auto backup samba profiles by ftp
« on: June 08, 2012, 07:53:28 »
hi guys, got a small trick to share with you

i wanted to backup my users' samba profiles/data/files on daily basis and need an automatic way to do it

before this, i've had a cronjob setup as

Code: [Select]
@weekly /home/user1/cronjobs/testcron.sh
where testcron.sh has

Code: [Select]
tar -cvf /backup/profiles_$(date +%Y%m%d_%H%M%S).tar /home/samba/profiles
in it. Now I've created a new testup.sh with

Code: [Select]
#!/bin/sh
# testup.sh
#################################
tar -cvf /backup/profiles_$(date +%Y%m%d_%H%M%S).tar /home/samba/profiles
curl -u yourFTPuser:yourFTPpass -T /backup/profilesBU_$(date +%Y%m%d)* ftp://yourFTPhost/profiles_$(date +%Y%m%d_%H%M%S).tar

add this with @daily and it'll run each day so u don't have to manually backup the user data anymore. Perhaps not too elegant, but it does the job just fine.

Happy digging (linux/ubuntu/zent) :)

Credit goes to http://stackoverflow.com/questions/814322/how-to-use-linux-command-line-ftp-with-a-sign-in-my-username

I was looking into sftp, but then it's way too complicated for an auto method, u need to add ssh-keyring and what not. curl seems to be doing the job just fine. I unno about the security issue, if there is one, though.

And it's better to create an separate account, for a specific folder outside of the public_html area.
« Last Edit: June 08, 2012, 07:57:46 by No Smile »
meep* meep*