Skip to content

Instantly share code, notes, and snippets.

@numanturle numanturle/yedek.sh
Created Nov 5, 2018

Embed
What would you like to do?
#!/bin/sh
BACKUP=/tmp/backup.$$
NOW=$(date +"%Y-%m-%d")
FTPD="/yedek"
FTPS="SUNUCU"
FTPU="USER"
FTPP="PASS"
FTPPO="PORT"
DBS="dbname dbname2 mysql"
[ ! -d $BACKUP ] && mkdir -p $BACKUP || :
cd /var/db/mysql && tar -cvzf $BACKUP/db-yedek.$NOW-$(date +"%H-%M-%S").tar.gz $DBS
ftp ftp://$FTPU:$FTPP@$FTPS:$FTPPO/<<EOF
mkdir $FTPD
mkdir /$FTPD/$NOW
cd /$FTPD/$NOW
lcd $BACKUP
put *
quit
EOF
rm -rf $BACKUP/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.