[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Dump contents of directory to samba share

Hi Folks,

I want to take the contents of various config (/etc) directories and regularly zip them up and copy to a remote samba location.

I'm looking for suggestions as to the most effective/efficient/eloquent script to acheive this.

It would also be neat if this script can issue an email alert to some remote address if there is any problem.

Assume that I am a ahell script novice but intermediate shell user.

Will award points to suggestions that help he write it myself, or double these points for writing it for me ;-)

Thanks in advance!

Mike.
0
meverest
Asked:
meverest
  • 2
1 Solution
 
owensleftfootCommented:
First create a mountpoint for a samba share - mkdir /mnt/backup
Then mount the samba share - mount -t smbfs //sambaserver/share /mnt/samba

After that your script could be as simple as
zip -d etcbackup /etc/*
mv etc/backup /mnt/samba
0
 
owensleftfootCommented:
should read mv etcbackup /mnt/samba
0
 
meverestAuthor Commented:
OK,

that does the job.  for prosperity, this is the result:

--------------8X--------------------------------------------------------------------------------
smbmount //myserver/backup$ /mountpoint -o username=myuser,password=mypass
zip -r /etc/etcback /etc/*
cp /etc/etcback.zip /mountpoint /mypath/etcback_`date +"%d_%b_%Y_%H%M"`.zip
umount /mountpoint
--------------8X--------------------------------------------------------------------------------

does the job nicely, thanks!
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now