Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- hostname=""
- username=""
- password=""
- keepage="7 days"
- gpgrecipient=""
- local_hostname=$(hostname)
- date=/bin/date
- ncftp=/usr/bin/ncftp
- ncftpput=/usr/bin/ncftpput
- today=$($date +%Y%m%d)
- old=$($date -d "$keepage ago" +%Y%m%d)
- $ncftp -u $username -p $password $hostname <<END
- mkdir $local_hostname
- cd $local_hostname
- rm $today/*
- rmdir $today
- rm $old/*
- rmdir $old
- mkdir $today
- END
- for i in /var/www/virtual/* /var/www/ispcp; do
- for j in $i/backups/*.bz2; do
- gpg --batch --yes -e -r $gpgrecipient -s $j
- filename="$j.gpg"
- $ncftpput -u $username -p $password $hostname "$local_hostname/$today" $filename
- rm $filename
- done
- done
Add Comment
Please, Sign In to add comment