Skrypty

Skrypt bakup-rotate.sh

#!/bin/bash BACKUP_DEST=/backup BACKUP_ROTATE=7 count=`ls -1 $BACKUP_DEST/ | wc -l` if [ $count -gt $BACKUP_ROTATE ]; then rm -rf $BACKUP_DEST/`ls -1 $BACKUP_DEST/ | sort | head -n 1` fi

Posted in Skrypty | Leave a comment

Skrypt backup-mysql.sh

#!/bin/bash DATE=$(date +%Y-%m-%d) BACKUP_DEST=/backup/$DATE MYSQL_USER=user MYSQL_PASS=tajne hasło MYSQL_DB=Nazwa_bazy mkdir -p $BACKUP_DEST cd /$BACKUP_DEST mysqldump -u$MYSQL_USER -p$MYSQL_PASS $MYSQL_DB > $MYSQL_DB.sql

Posted in Skrypty | Leave a comment

Skrypt backup-files.sh

#!/bin/bash DATE=$(date +%Y-%m-%d) BACKUP_DEST=/backup/$DATE BACKUP_FILES=/home/user/ ARCHIVE_FILES=$DATE.user.tar.gz mkdir -p $BACKUP_DEST tar czpPf $BACKUP_DEST/$ARCHIVE_FILES $BACKUP_FILES

Posted in Skrypty | Leave a comment