Script bash que facilita realizar una copia de seguridad de los archivos WTMP y WTMPX en SCO Openserver.
This file contains 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 | |
# -- Respaldo de archivos wtmp y wtmpx | |
# Las copias de seguridad se depositan | |
# en el directorio /var/log. | |
DIA=`date +"%Y%m%d"` | |
HORA=`date +"%H%M"` | |
ARCHIVO_WTMP=wtmp_$DIA-$HORA | |
ARCHIVO_WTMPX=wtmpx_$DIA-$HORA | |
# -- Copia y compacta los archivos | |
cp /etc/wtmp /var/log/bkp_wtmp/$ARCHIVO_WTMP | |
rm /var/log/bkp_wtmp/$ARCHIVO_WTMP.* | |
pack /var/log/bkp_wtmp/$ARCHIVO_WTMP | |
cp /etc/wtmpx /var/log/bkp_wtmpx/$ARCHIVO_WTMPX | |
rm /var/log/bkp_wtmpx/$ARCHIVO_WTMPX.* | |
pack /var/log/bkp_wtmpx/$ARCHIVO_WTMPX | |
# -- Finalmente realiza el cleanup | |
# See if day it's the first from mounth. | |
TODAY=`date +%d` | |
if [ $TODAY -eq "01" ]; then | |
/etc/cleanup | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment