Indice del forum www.zeroshell.net
Distribuzione Linux ZeroShell
 
 FAQFAQ   CercaCerca  GruppiGruppi   RegistratiRegistrati 
 ProfiloProfilo  Log inLog in   Messaggi privatiMessaggi privati 

Script per update blacklists

 
Nuovo argomento   Rispondi    Indice del forum -> Proxy con antivirus
Precedente :: Successivo  
Autore Messaggio
xvince



Registrato: 12/03/10 18:17
Messaggi: 43
Residenza: L'Aquila

MessaggioInviato: Mer Nov 11, 2015 2:10 pm    Oggetto: Script per update blacklists Rispondi citando

Buongiorno, non so se č stato gią postato, non l'ho trovato sul forum, ma ho realizzato uno script per aggiornare le blacklist di dansguardian su ZS3.4.0.
Sono partito dallo script di urlblacklist.com, ma visto che č a pagamento ho utlizzato il file di shallalist.de.
A fine script ricevo un errore, ma mi sembra che dansguadian si avvii correttamente ricaricando le liste.

xvince

# Bash script: dgblacklists-Cron
export BL_URL=${BL_URL:="http://www.shallalist.de/Downloads/shallalist.tar.gz"}
export DB_PATH=${DB_PATH:="/opt/dg2/etc/dansguardian/lists/blacklists"}
export HOME_DIR="/tmp"
export SG_UGID=${SG_UGID:="root:root"}
export UNCOMP_CMD="gunzip"
export UNTAR_DIR="BL"
export VERS="0.0.1alpha"

# Create a few working variables.
export BL_TAR_BASE="`basename ${BL_URL}`"
export BL_TAR_FULL="${HOME_DIR}/${BL_TAR_BASE}"
export TMP_DIR="/tmp/blacklists"

# Output a quick startup message.
echo "==="
echo "Starting Blacklist update v${VERS}: `date '+%Y/%m/%d %T'`"

# We use $TMP_DIR as a working directory for wget and the untar process,
# so we start by cd-ing into it. We create it if it doesn't exist, and
# if there is already something in the way then we abort.
if [ ! -d "${TMP_DIR}" ]
then
if [ -e "${TMP_DIR}" ]
then
echo "ERROR: ${TMP_DIR} already exists, but isn't a directory;"
echo " aborting Blacklist refresh."
exit 1
fi

mkdir "${TMP_DIR}"
fi

cd "${TMP_DIR}"
if [ "$?" != "0" ]
then
echo "ERROR: unable to cd into working directory,"
echo " ${TMP_DIR}"
exit 1
else
if [ -f "${BL_TAR_FULL}" ]
then
mv -f "${BL_TAR_FULL}" "${BL_TAR_FULL}.1"
fi

if [ -f "./${BL_TAR_BASE}" ]
then
echo "Moving old ${BL_TAR_BASE} out of the way."
mv -f "./${BL_TAR_BASE}" "${BL_TAR_FULL}"
fi

echo "Running wget to retrieve new lists."
wget -nv "${BL_URL}"
if [ "$?" != "0" ]
then
echo "ERROR: unable to retrieve new lists,"
echo " aborting blacklist refresh."
exit 1
else
echo "Succesfully retrieved new lists."

echo "Untaring Blacklist archive, ${BL_TAR_BASE}"
"${UNCOMP_CMD}" <"${BL_TAR_BASE}" | tar -xf -
if [ "$?" != "0" ]
then
echo "ERROR: unable to extract new lists,"
echo " aborting blacklist refresh."
exit 1
else
echo "Moving new lists into place."
for i in "${UNTAR_DIR}"/*
do
export ib="`basename ${i}`"
if [ -d "${DB_PATH}/${ib}" ]
then
rm -rf "${DB_PATH}/${ib}"
fi

mv "${UNTAR_DIR}/${ib}" "${DB_PATH}"

done

echo "Remove temporary files and folders."
rm -rdf "${TMP_DIR}"

echo "Change owner and permissions."
chown -R "${SG_UGID}" "${DB_PATH}"
chmod -R 755 "${DB_PATH}"

echo "Restarting Dansguardian."
/root/kerbynet.cgi/scripts/dg_start

# Output a quick end message.
echo "Finished Blacklist update: `date '+%Y/%m/%d %T'`"
echo "==="

exit $?
####
#### If everything went well, we exited here.
####
fi
fi
fi


===
Starting Blacklist update v0.0.1alpha: 2015/11/11 13:01:17
Running wget to retrieve new lists.
13:01:20 URL:http://www.shallalist.de/Downloads/shallalist.tar.gz [9978881/9978881] -> "shallalist.tar.gz" [1]
Succesfully retrieved new lists.
Untaring Blacklist archive, shallalist.tar.gz
Moving new lists into place.
Remove temporary files and folders.
Change owner and permissions.
Restarting Dansguardian.
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Reporting_level is : 0 file /opt/dg2/etc/dansguardian/dansguardianf1.conf
Finished Blacklist update: 2015/11/11 13:01:28
===

[Cron dgblacklists]: SUCCESS
Top
Profilo Invia messaggio privato
Mostra prima i messaggi di:   
Nuovo argomento   Rispondi    Indice del forum -> Proxy con antivirus Tutti i fusi orari sono GMT + 1 ora
Pagina 1 di 1

 
Vai a:  
Non puoi inserire nuovi argomenti
Non puoi rispondere a nessun argomento
Non puoi modificare i tuoi messaggi
Non puoi cancellare i tuoi messaggi
Non puoi votare nei sondaggi


Powered by phpBB © 2001, 2005 phpBB Group
phpbb.it