MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 4 as of 2023-10-12 15:56:43
  • SambaShare

Samba share

Samba3 by example

  • https://www.samba.org/samba/docs/Samba3-ByExample.pdf

Mount samba share on CentOS 6.3

Adapted from http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-samba-connect-share.html

   1 yum install cifs-utils
   2 mount -t cifs -o username=userx,password=passwordx //<servername>/<sharename> /mnt/point/

Add entry to /etc/fstab:

   1 //<servername>/<sharename> /mnt/point/ cifs  username=userx,password=passwordx,_netdev   0 0

Backup all files

File backup.sh:

   1 #!/bin/bash
   2 logfile=/mnt/point/backups`date '+%F'`.log
   3 datex=`date '+%FT%T'`
   4 hostx=`hostname`
   5 backfile=/mnt/point/"$hostx"_backup.tar.gz
   6 
   7 echo "$datex $hostx Log file: $logfile" >> $logfile
   8 echo "$datex $hostx Executing backup on /mnt/point" >> $logfile
   9 cd /
  10 rm $backfile
  11 echo "$datex $hostx Removed $backfile" >> $logfile
  12 tar cpzf $backfile --exclude=/proc --exclude=/dev --exclude=/media --exclude=/mnt --exclude=/lost+found  /  >> $logfile
  13 datex=`date '+%FT%T'`
  14 echo "$datex $hostx Ended backup on /mnt/point" >> $logfile

Add a crontab entry like @daily /home/userx/backup.sh.

smbclient Copy files recursively to share

  • smbclient -U userx //192.168.1.1/c$ -c 'cd folderx;recurse;prompt;mput *'
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01