Skip to content

Instantly share code, notes, and snippets.

@gabrielkfr
Created September 4, 2013 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielkfr/6432758 to your computer and use it in GitHub Desktop.
Save gabrielkfr/6432758 to your computer and use it in GitHub Desktop.
Script bash que facilita realizar una copia de seguridad de los archivos WTMP y WTMPX en SCO Openserver.
#!/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