Révision 9aa6d7e9
shellcheck fixes for pdns-server plugins.
| plugins/pdns/pdns_rel | ||
|---|---|---|
| 38 | 38 |
|
| 39 | 39 |
hits=$($command packetcache-hit) |
| 40 | 40 |
queries=$($command udp-queries) |
| 41 |
if [ -f $state_file ]; then
|
|
| 42 |
old_hits=$(cat $state_file | head -n1)
|
|
| 43 |
old_queries=$(cat $state_file | tail -n1)
|
|
| 41 |
if [ -f "$state_file" ]; then
|
|
| 42 |
old_hits=$(head -n1 "$state_file")
|
|
| 43 |
old_queries=$(tail -n1 "$state_file")
|
|
| 44 | 44 |
fi |
| 45 | 45 |
|
| 46 |
if [ -f $state_file ] && [ $(ls -l --time-style=+%s $state_file | awk '{print $6}') -gt $(date --date="7 minutes ago" +%s) ] ; then
|
|
| 47 |
d_hits=$(($hits - $old_hits))
|
|
| 48 |
d_queries=$(($queries - $old_queries))
|
|
| 46 |
if [ -f "$state_file" ] && [ "$(stat --format=%Y "$state_file")" -gt "$(date --date="7 minutes ago" +%s)" ] ; then
|
|
| 47 |
d_hits=$((hits - old_hits))
|
|
| 48 |
d_queries=$((queries - old_queries))
|
|
| 49 | 49 |
if [ $d_queries -gt 0 ] ; then |
| 50 |
echo packetcache_hitrate.value $(( $d_hits * 100 / $d_queries ))
|
|
| 50 |
echo packetcache_hitrate.value $(( d_hits * 100 / d_queries ))
|
|
| 51 | 51 |
fi |
| 52 | 52 |
fi |
| 53 | 53 |
|
| 54 |
echo $hits > $state_file |
|
| 55 |
echo $queries >> $state_file |
|
| 54 |
echo "$hits" > "$state_file" |
|
| 55 |
echo "$queries" >> "$state_file" |
|
Formats disponibles : Unified diff