Código BASH:
Ver original
#!/bin/sh user="root" pass="toor" mysqldump -u$user -p$pass --opt fsrp > /respaldo/bd.sql cd /respaldo tar -zcvf respaldo_$(date +%d-%m-%y).tgz *.sql find -name '*.tgz' -type f -mtime +2 -exec rm -f {} \; echo "Backup se genero bien Successful: $(date)" > /var/log/envio/backup.log sleep 1 SUBJECT="Backup de base de datos" EMAIL="[email protected]" MESSAGE="Backup de base de datos" EMAILMESSAGE="/var/log/envio/emailmessage.txt" echo "Backup de Paneles" > $EMAILMESSAGE cp respaldo_$(date +%d-%m-%y).tgz backup_paneles.tgz (cat $EMAILMESSAGE; uuencode backup_paneles.tgz backup_paneles.tgz) | mailx -s "$SUBJECT" "$EMAIL" sleep 1 rm backup_paneles.tgz