[Dxspider-support] Prefix data update automation.
Bastien F4EYQ
f4eyq at crx.cloud
Wed Jan 22 18:21:24 CET 2020
Hello to all,
I've write this script for data update, it run every week via a cron and
do the job.
My question is : is there any other method to reload the dxspider ?
i'm using this :
#restart dxspider :
PID=$(cat /spider/local/cluster.lck);
kill -KILL $PID;
rm -f /spider/local/cluster.lck
/bin/su - sysop -c "/usr/bin/perl -w /spider/perl/cluster.pl" >
/dev/tty7 &
73 Bastien
PS: Here is the script
#!/bin/bash
#cfg
RMTWPX=http://www.country-files.com/cty/wpxloc.raw
RMTCTY=http://www.country-files.com/cty/cty.dat
FILECTY=/home/sysop/sources/data_files/cty.dat
FILEWPX=/home/sysop/sources/data_files/wpxloc.raw
SPFILECTY=/spider/data/cty.dat
SPFILEWPX=/spider/data/wpxloc.raw
CURRDATE=$(date -I);
#download and diff if new :
#clean old tmp files :
rm -f $FILECTY
rm -f $FILEWPX
#download online files :
echo "$CURRDATE - INFO download files : $RMTCTY and $RMTWPX";
wget $RMTCTY -O $FILECTY &>/dev/null
if [ $? -ne 0 ]
then
echo "$CURRDATE - ERROR file not found : $RMTCTY";
exit 0;
fi
wget $RMTWPX -O $FILEWPX &>/dev/null
if [ $? -ne 0 ]
then
echo "$CURRDATE - ERROR file not found : $RMTWPX";
exit 0;
fi
#now check if new update is needed :
MOD=0;
diff $FILECTY $SPFILECTY &>/dev/null
if [ $? -ne 0 ]
then
echo "$CURRDATE - INFO new version of $SPFILECTY exist!"
MOD=1;
fi
diff $FILEWPX $SPFILEWPX &>/dev/null
if [ $? -ne 0 ]
then
echo "$CURRDATE - INFO new version of $SPFILEWPX exist!"
MOD=1;
fi
#if needed update prefix file :
if [ $MOD -eq 1 ]
then
cp $FILECTY $SPFILECTY
cp $FILEWPX $SPFILEWPX
echo "$CURRDATE - INFO -> launch dxspider prefix update ... ";
/spider/perl/create_prefix.pl
#restart dxspider :
PID=$(cat /spider/local/cluster.lck);
kill -KILL $PID;
rm -f /spider/local/cluster.lck
/bin/su - sysop -c "/usr/bin/perl -w /spider/perl/cluster.pl" >
/dev/tty7 &
echo -e "$CURRDATE - INFO -> restart dxspider."
else
echo -e "$CURRDATE - INFO -> dxspider prefix data is up2date!";
fi
More information about the Dxspider-support
mailing list