SHARE
TWEET

Untitled

a guest Apr 27th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #
  3. # Backup folder to storage
  4.  
  5. # Check if command is finished without errors
  6.  
  7. function startit() {
  8. command_output=$(eval $1)
  9. output_value=$?
  10. if [ $output_value != 0 ]; then
  11.   echo "Failure!" >> /var/log/backup/sharefiles/webserver_$TIMES.log
  12.   exit -1
  13. else
  14.   echo "Success!" >> /var/log/backup/sharefiles/webserver_$TIMES.log
  15. fi
  16. return $output_value
  17. }
  18.  
  19. # Parameters
  20.  
  21. SHARED="/folder/shared/"
  22. MOUNTPOINT="//server.some.address/backup/SharedFiles/"
  23. TARGET="/backup/shared/"
  24. TIMES=`date '+%Y.%m.%d_%H'`
  25. TIMESTART=`date '+%Y.%m.%d %H:%M'`
  26. USERNAME="someusername"
  27. PASS="somepass"
  28.  
  29. # BackupStart
  30.  
  31. echo "Backup is started" >> /var/log/backup/sharefiles/webserver_$TIMES.log
  32. echo "Now is $TIMESTART" >> /var/log/backup/sharefiles/webserver_$TIMES.log
  33.  
  34. # Mount shared folder to server
  35.  
  36. echo "Mount Storage share" >> /var/log/backup/sharefiles/webserver_$TIMES.log
  37. startit "mount -t cifs -o user=$USERNAME,password=$PASS $MOUNTPOINT $TARGET"
  38.    
  39. mount error(2): No such file or directory
  40. Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
  41.    
  42. startit "mount -t cifs -o user=someusername,password=somepass //server.some.address/backup/SharedFiles/ /backup/shared/"
  43.    
  44. startit "mount -t cifs -o user=$USERNAME,password=$PASS $MOUNTPOINT $TARGET"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top