Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Tests if the file exists before getting mtime. | 43044a8d442884e20ba866f0f92bf655bc02b131 | Catalin(ux) M. BOIE | 2010-07-05 14:36:51 |
Initial version (0.0.90). | 5807f4955d446127a7b873f5f3918f408ab93fff | Catalin(ux) M. BOIE | 2010-07-01 15:39:22 |
File | Lines added | Lines deleted |
---|---|---|
crons/ip2c_ip-to-country | 6 | 2 |
crons/ip2c_maxmind-ipv4 | 6 | 2 |
crons/ip2c_maxmind-ipv6 | 6 | 2 |
crons/ip2c_software77 | 7 | 2 |
File crons/ip2c_ip-to-country changed (mode: 100644) (index 6cb8a56..f21c28c) | |||
... | ... | cd /var/cache/ip2clue | |
16 | 16 | ||
17 | 17 | data_file="ip-to-country.csv.zip" | data_file="ip-to-country.csv.zip" |
18 | 18 | ||
19 | mtime=`stat --format="%Z" ${data_file}` | ||
20 | next=$[${mtime} + ${ip_to_location} * 24 * 3600] | ||
19 | if [ -r "${data_file}" ]; then | ||
20 | mtime=`stat --format="%Z" ${data_file}` | ||
21 | next=$[${mtime} + ${ip_to_location} * 24 * 3600] | ||
22 | else | ||
23 | next=0 | ||
24 | fi | ||
21 | 25 | echo "mtime=${mtime}, next=${next}, now=`date +%s`" | echo "mtime=${mtime}, next=${next}, now=`date +%s`" |
22 | 26 | if [ "${next}" -ge "`date +%s`" ]; then | if [ "${next}" -ge "`date +%s`" ]; then |
23 | 27 | # do not update yet | # do not update yet |
File crons/ip2c_maxmind-ipv4 changed (mode: 100644) (index ab09c3d..f926659) | |||
... | ... | cd /var/cache/ip2clue | |
16 | 16 | ||
17 | 17 | data_file="maxmind-ipv4.csv.zip" | data_file="maxmind-ipv4.csv.zip" |
18 | 18 | ||
19 | mtime=`stat --format="%Z" ${data_file}` | ||
20 | next=$[${mtime} + ${maxmind_ipv4} * 24 * 3600] | ||
19 | if [ -r "${data_file}" ]; then | ||
20 | mtime=`stat --format="%Z" ${data_file}` | ||
21 | next=$[${mtime} + ${maxmind_ipv4} * 24 * 3600] | ||
22 | else | ||
23 | next=0 | ||
24 | fi | ||
21 | 25 | echo "mtime=${mtime}, next=${next}, now=`date +%s`" | echo "mtime=${mtime}, next=${next}, now=`date +%s`" |
22 | 26 | if [ "${next}" -ge "`date +%s`" ]; then | if [ "${next}" -ge "`date +%s`" ]; then |
23 | 27 | # do not update yet | # do not update yet |
File crons/ip2c_maxmind-ipv6 changed (mode: 100644) (index 8a8ae6d..5a9de77) | |||
... | ... | cd /var/cache/ip2clue | |
16 | 16 | ||
17 | 17 | data_file="maxmind-ipv6.csv.gz" | data_file="maxmind-ipv6.csv.gz" |
18 | 18 | ||
19 | mtime=`stat --format="%Z" ${data_file}` | ||
20 | next=$[${mtime} + ${maxmind_ipv6} * 24 * 3600] | ||
19 | if [ -r "${data_file}" ]; then | ||
20 | mtime=`stat --format="%Z" ${data_file}` | ||
21 | next=$[${mtime} + ${maxmind_ipv6} * 24 * 3600] | ||
22 | else | ||
23 | next=0 | ||
24 | fi | ||
21 | 25 | echo "mtime=${mtime}, next=${next}, now=`date +%s`" | echo "mtime=${mtime}, next=${next}, now=`date +%s`" |
22 | 26 | if [ "${next}" -ge "`date +%s`" ]; then | if [ "${next}" -ge "`date +%s`" ]; then |
23 | 27 | # do not update yet | # do not update yet |
File crons/ip2c_software77 changed (mode: 100644) (index ba6ddd5..3feab3d) | |||
... | ... | old_md5="IpToCountry.csv.md5" | |
17 | 17 | new_md5="IpToCountry.csv.new.md5" | new_md5="IpToCountry.csv.new.md5" |
18 | 18 | data_file="IpToCountry.csv.gz" | data_file="IpToCountry.csv.gz" |
19 | 19 | ||
20 | mtime=`stat --format="%Z" ${data_file}` | ||
21 | next=$[${mtime} + ${iptocountry} * 24 * 3600] | ||
20 | if [ -r "${data_file}" ]; then | ||
21 | mtime=`stat --format="%Z" ${data_file}` | ||
22 | next=$[${mtime} + ${iptocountry} * 24 * 3600] | ||
23 | else | ||
24 | next=0 | ||
25 | fi | ||
22 | 26 | echo "mtime=${mtime}, next=${next}, now=`date +%s`" | echo "mtime=${mtime}, next=${next}, now=`date +%s`" |
23 | 27 | if [ "${next}" -ge "`date +%s`" ]; then | if [ "${next}" -ge "`date +%s`" ]; then |
24 | 28 | # do not update yet | # do not update yet |
25 | 29 | exit 0 | exit 0 |
26 | 30 | fi | fi |
27 | 31 | ||
32 | # md5 of the file | ||
28 | 33 | wget "http://software77.net/geo-ip?DL=3" -O "${new_md5}" | wget "http://software77.net/geo-ip?DL=3" -O "${new_md5}" |
29 | 34 | ||
30 | 35 | # wait some random time... | # wait some random time... |