2023-01-08 11:57:13 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-01-08 12:11:41 +01:00
|
|
|
usage() { echo "Usage: $0 [-f dbp.ini]" 1>&2; exit 1; }
|
|
|
|
|
|
|
|
while getopts ":f:" o; do
|
|
|
|
case "${o}" in
|
|
|
|
f)
|
|
|
|
INIFILE=${OPTARG}
|
2023-01-08 12:54:07 +01:00
|
|
|
;;
|
2023-01-08 12:11:41 +01:00
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
2023-01-08 11:57:13 +01:00
|
|
|
done
|
2023-01-08 12:11:41 +01:00
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
2023-01-08 12:48:38 +01:00
|
|
|
if [ -z "${INIFILE}" ]; then
|
2023-01-08 12:11:41 +01:00
|
|
|
usage
|
|
|
|
fi
|
2023-01-08 11:57:13 +01:00
|
|
|
|
2023-01-08 12:11:41 +01:00
|
|
|
MYSTIC_DIR="@MYSTIC_DIR@"
|
2023-01-08 11:57:13 +01:00
|
|
|
TMP_DIR=$(mktemp -d)
|
|
|
|
|
|
|
|
MIS_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k MisLog --silent`
|
|
|
|
MUTIL_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k MutilLog --silent`
|
|
|
|
ERROR_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k ErrorLog --silent`
|
|
|
|
MRCCHAT_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k MrcChatLog --silent`
|
|
|
|
NODE_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k NodeLog --silent`
|
|
|
|
|
|
|
|
IP2L_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k Ip2Location --silent`
|
|
|
|
IP2L_TOKEN=`${MYSTIC_DIR}/inimod r ${INIFILE} -S Ip2Location -k Token --silent`
|
|
|
|
IP2L_DB=`${MYSTIC_DIR}/inimod r ${INIFILE} -S Ip2Location -k Database --silent`
|
|
|
|
|
|
|
|
YESTERDAY=$(date '+%Y%m%d' -d "-1days")
|
|
|
|
NOW=$(date '+%Y%m%d')
|
|
|
|
TOMORROW=$(date '+%Y%m%d' -d "+1days")
|
|
|
|
|
|
|
|
if [ $MIS_ENABLE = "true" ]; then
|
|
|
|
touch ${MYSTIC_DIR}/logs/mis.${NOW}.log
|
|
|
|
touch ${MYSTIC_DIR}/logs/mis.${TOMORROW}.log
|
|
|
|
ln -sf mis.${NOW}.log ${MYSTIC_DIR}/logs/mis.log
|
|
|
|
[ -f /${MYSTIC_DIR}/logs/mis.${YESTERDAY}.log ] && gzip -9 ${MYSTIC_DIR}/logs/mis.${YESTERDAY}.log
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $MUTIL_ENABLE = "true" ]; then
|
|
|
|
touch ${MYSTIC_DIR}/logs/mutil.${NOW}.log
|
|
|
|
touch ${MYSTIC_DIR}/logs/mutil.${TOMORROW}.log
|
|
|
|
ln -sf mutil.${NOW}.log ${MYSTIC_DIR}/logs/mutil.log
|
|
|
|
[ -f /${MYSTIC_DIR}/logs/mutil.${YESTERDAY}.log ] && gzip -9 ${MYSTIC_DIR}/logs/mutil.${YESTERDAY}.log
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $ERROR_ENABLE = "true" ]; then
|
|
|
|
touch ${MYSTIC_DIR}/logs/errors.${NOW}.log
|
|
|
|
touch ${MYSTIC_DIR}/logs/errors.${TOMORROW}.log
|
|
|
|
ln -sf errors.${NOW}.log ${MYSTIC_DIR}/logs/errors.log
|
|
|
|
[ -f /${MYSTIC_DIR}/logs/errors.${YESTERDAY}.log ] && gzip -9 ${MYSTIC_DIR}/logs/errors.${YESTERDAY}.log
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $MRCCHAT_ENABLE = "true" ]; then
|
|
|
|
touch ${MYSTIC_DIR}/logs/mrcchat.${NOW}.log
|
|
|
|
touch ${MYSTIC_DIR}/logs/mrcchat.${TOMORROW}.log
|
2023-01-08 12:54:07 +01:00
|
|
|
mkdir -p ${MYSTIC_DIR}/data/mrc/
|
2023-01-08 11:57:13 +01:00
|
|
|
ln -sf ../../logs/mrcchat.${NOW}.log ${MYSTIC_DIR}/data/mrc/mrcchat.log
|
|
|
|
ln -sf mrcchat.${NOW}.log ${MYSTIC_DIR}/logs/mrcchat.log
|
|
|
|
[ -f /${MYSTIC_DIR}/logs/mrcchat.${YESTERDAY}.log ] && gzip -9 ${MYSTIC_DIR}/logs/mrcchat.${YESTERDAY}.log
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $NODE_ENABLE = "true" ]; then
|
|
|
|
for i in {0..10}
|
|
|
|
do
|
|
|
|
touch ${MYSTIC_DIR}/logs/node${i}.${NOW}.log
|
|
|
|
touch ${MYSTIC_DIR}/logs/node${i}.${TOMORROW}.log
|
|
|
|
ln -sf node${i}.${NOW}.log ${MYSTIC_DIR}/logs/node${i}.log
|
|
|
|
[ -f ${MYSTIC_DIR}/logs/node${i}.${YESTERDAY}.log ] && gzip -9 ${MYSTIC_DIR}/logs/node${i}.${YESTERDAY}.log
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $IP2L_ENABLE = "true" ]; then
|
2023-01-08 12:48:38 +01:00
|
|
|
${MYSTIC_DIR}/ip2location -package ${IP2L_DB} -token ${IP2L_TOKEN} -output ${TMP_DIR}/IP2LOCATION.ZIP
|
|
|
|
unzip -o ${TMP_DIR}/IP2LOCATION.ZIP -x *.TXT -d ${TMP_DIR}
|
2023-01-08 11:57:13 +01:00
|
|
|
unzip -o ${TMP_DIR}/IP2LOCATION.ZIP -x *.BIN -d ${MYSTIC_DIR}/docs
|
2023-01-08 12:48:38 +01:00
|
|
|
mv ${TMP_DIR}/IP2LOCATION-*.BIN ${MYSTIC_DIR}/data/iplocation.bin
|
2023-01-08 11:57:13 +01:00
|
|
|
rm -rf ${TMP_DIR}
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|