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

  • 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!

  • 2
1 Solution
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
should read mv etcbackup /mnt/samba
meverestAuthor Commented:

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

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

does the job nicely, thanks!

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