마운트에 사용될 계정으로 마운트

id

smbclient -L [IP]

sudo mount.cifs //192.168.0.1/BACKUP /BACKUP -o,username=hoknas,sec=ntlm,vers=2.0,uid=1000,gid=1000

umount /BACKUP

백업스크립트
#!/bin/bash
NOW_FILE_POST_FIX=`date +%Y%m%d%H%M%S`

NOW_FILE_DB=NAS_DATABASE_$NOW_FILE_POST_FIX
NOW_FILE_FS=NAS_DATAFILE_$NOW_FILE_POST_FIX

echo "Backup $NOW_FILE_DB..."
echo "Backup $NOW_FILE_FS..."

mysqldump -u[계정] -p[암호] nas_schema > /storage/backup/"$NOW_FILE_DB".sql
stat -c%s /storage/backup/"$NOW_FILE_DB".sql > /storage/backup/"$NOW_FILE_DB".sql.hash
cp /storage/backup/"$NOW_FILE_DB".sql /BACKUP
cp /storage/backup/"$NOW_FILE_DB".sql.hash /BACKUP


tar -zcvpf /storage/backup/"$NOW_FILE_FS".tar.gz --exclude=/storage/web/data /storage/web/
stat -c%s /storage/backup/"$NOW_FILE_FS".tar.gz > /storage/backup/"$NOW_FILE_FS".tar.gz.hash
cp /storage/backup/"$NOW_FILE_FS".tar.gz /BACKUP
cp /storage/backup/"$NOW_FILE_FS".tar.gz.hash /BACKUP


  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기