Цитата:/path/to/script.sh snap
#!/bin/bash HOMEPOINT='/home/folder' #edit accordingly FTPMOUNT='website/path/to/files #edit accordingly MOUNTPOINT="$HOMEPOINT/ftpfolder" #edit accordingly BACKUPPOINT="$HOMEPOINT/backup.0/" #edit accordingly USERPASS="someuser:somepass" #edit accordingly NUMBERBACKUPS=2 #edit accordingly function snapshot { COUNT=$NUMBERBACKUPS while [ $COUNT -gt 1 ]; do test -d $HOMEPOINT/backup.$((COUNT-1)) && mv $HOMEPOINT/backup.$((COUNT-1)) $HOMEPOINT/backup.$COUNT ((COUNT--)) done test -d $BACKUPPOINT && mv $BACKUPPOINT $HOMEPOINT/backup.1 mv $HOMEPOINT/backup.log $HOMEPOINT/backup.log.1 } if grep -qs "$MOUNTPOINT" /proc/mounts; then fusermount -u $MOUNTPOINT/ && curlftpfs ftp://$FTPMOUNT $MOUNTPOINT -o user=$USERPASS || exit 5 else curlftpfs ftp://$FTPMOUNT $MOUNTPOINT -o user=$USERPASS || exit 1 fi if [ "$1" == "snap" ]; then snapshot fi rsync -avr --delete $MOUNTPOINT/ $BACKUPPOINT/ --log-file=$HOMEPOINT/backup.log || exit 4 fusermount -u $MOUNTPOINT/ || exit 5