Created
September 4, 2013 04:51
-
-
Save gabrielkfr/6432876 to your computer and use it in GitHub Desktop.
Script bash que permite llamar y pasar comandos al cliente ftp en tiempo de ejecución.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# -- Declaracion de variables. | |
FTP_SERVER=ip_servidor | |
FTP_USER=nombre_usuario | |
FTP_PASS=contraseña_usuario | |
FTP_LOCAL_CD=/tmp | |
BACKUP_NAME=backup_opt.tar.gz | |
# -- Realizando backup de /opt. | |
tar -czf $FTP_LOCAL_CD/$BACKUP_NAME /opt | |
# -- Copiando archivo backup a servidor ftp. | |
/usr/bin/ftp -n <<EOD | |
open $FTP_SERVER | |
quote USER $FTP_USER | |
quote PASS $FTP_PASS | |
binary | |
prompt | |
lcd $FTP_LOCAL_CD | |
put $BACKUP_NAME | |
bye | |
EOD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment