Pour le sh il me fait qd même des erreurs mais la mise a jour fonctionne
le voila:
#!/bin/sh
###
# refreshSG - refresh the squidGuard Blacklist
#
# Version: 1.3
# Date: Apri 5, 2003
# Author: Gavin Spurgeon <gspurgeon@dageek.co.uk>,
# based largely on the work of Fernand Jonker <fernand@futuragts.com>
# and Christopher Rath <christopher@rath.ca>
###
###
# History
#
# 0.9 - Sept 1, 2002 - original release.
# 0.9.1 - Sept 4, 2002 - changed DG restart command and added cron
# information - minor cosmetic changes.
# 0.9.2 - Sept 9, 2002 - changed default download to the small test
# file and added history
# 1.3 - Apri 5, 2003 - changed default download to DaGeekz Blaclists Server
# also some modifications made to the script to allow it
# to work with IPCop v1.3.x & DaGeek's Add-Onz System
# (www.dageek.co.uk/ipcop)
###
###
# Don't allow undefined variables.
set -u
export BL_URL=${BL_URL:="http://ftp.teledanmark.no/pub/www/proxy/squidGuard/cont
rib/blacklists.tar.gz"}
export DB_PATH=${DB_PATH:="/etc/dansguardian"}
export HOME_DIR="/root"
export SG_UGID=${SG_UGID:="nobody:nobody"}
export UNCOMP_CMD="gunzip"
export UNTAR_DIR="/tmp/squidGuard_tmp/blacklists/"
export VERS="1.3"
# 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/squidGuard_tmp"
# Output a quick startup message.
echo "==="
echo "Starting squidGuard Blacklist update v${VERS}: `date '+%Y/%m/%d %T'`"
logger -t ipcop "==="
logger -t ipcop "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."
logger -t ipcop "ERROR: ${TMP_DIR} already exists, but isn't a directory
;"
logger -t ipcop " 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}"
logger -t ipcop "ERROR: unable to cd into working directory,"
logger -t ipcop " ${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."
logger -t ipcop "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."
logger -t ipcop "Running wget to retrieve new lists."
wget -nv "${BL_URL}"
if [ "$?" != "0" ]
then
echo "ERROR: unable to retrieve new lists,"
echo " aborting squidGuard refresh."
logger -t ipcop "ERROR: unable to retrieve new lists,"
logger -t ipcop " aborting blacklist refresh."
exit 1
else
echo "Succesfully retrieved new lists."
logger -t ipcop "Succesfully retrieved new lists."
echo "Untaring Blacklist archive, ${BL_TAR_BASE}"
logger -t ipcop "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 squidGuard refresh."
logger -t ipcop "ERROR: unable to extract new lists,"
logger -t ipcop " aborting blacklist refresh."
exit 1
else
echo "Moving new lists into place."
logger -t ipcop "Moving new lists into place."
#rm -f -r -v /etc/dansguardian/blacklists
mv -f -v "${UNTAR_DIR}" "${DB_PATH}"
echo "Remove temporary files and folders."
logger -t ipcop "Remove temporary files and folders."
rm -rf /tmp/squidGuard_tmp/*
echo "Change owner and permissions."
logger -t ipcop "Change owner and permissions."
chown -R "${SG_UGID}" "${DB_PATH}"
chmod -R 755 "${DB_PATH}"
echo "Restarting Dansguardian."
logger -t ipcop "Restarting Dansguardian."
killall dansguardian
#cd "${DG_PATH}"
dansguardian
echo "Finished Blacklist update: `date '+%Y/%m/%d %T'`"
echo "==="
logger -t ipcop "Finished Blacklist update: `date '+%Y/%m/%d %T'`"
logger -t ipcop "==="
exit $?
####
#### If everything went well, we exited here.
####
fi
fi
fi
Voilà