Facebook
From lampik, 2 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 348
  1. if [ -e /etc/ppp/timestamp."$name" ]; then
  2.         now=$(date +%s)
  3.         when_up=$(< /etc/ppp/timestamp."$name")
  4.          durati - when_up]
  5.          durati $duration)
  6.         rm -f /etc/ppp/timestamp."$name"
  7. else
  8.          durati
  9. fi
  10.  
  11. # usuwamy pozostałości tunelu
  12. iptables -t nat -D POSTROUTING -s $5 -j MASQUERADE
  13. iptables -D FORWARD -s $5 -j ACCEPT
  14.  
  15. dev=$1
  16. ip=$5
  17.  
  18. echo ".................................................................................."
  19. echo ".   `date` -- Disconected -- Interface: $dev"
  20. echo ".   `date` -- Disconected -- IP:        $ip"
  21.  
  22. case $ip in
  23.         192.168.1.2)    name="tomek";           subnet=192.168.22.0/24;;
  24.         192.168.1.3)    name="sklep";           subnet=192.168.18.0/24;;
  25.         192.168.1.4)    name="cymbark";         subnet=192.168.12.0/24;;
  26.         192.168.1.5)    name="monika";          subnet=192.168.17.0/24;;
  27.         192.168.1.6)    name="patryk";          subnet=192.168.13.0/24;;
  28.         192.168.1.7)    name="aleksandra";      subnet=192.168.16.0/24;;
  29.         192.168.1.8)    name="biurio";          subnet=192.168.14.0/24;;
  30.         192.168.1.9)    name="goscinny";        subnet=192.168.11.0/24;;
  31.         192.168.1.10)   name="kamila";          subnet=192.168.15.0/24;;
  32.         192.168.1.11)   name="mateusz";         subnet=192.168.10.0/24;;
  33.         192.168.1.12)   name="ania";            subnet=192.168.20.0/24;;
  34.         192.168.1.13)   name="parking";         subnet=192.168.21.0/24;;
  35.         192.168.1.14)   name="oleg";            subnet=192.168.24.0/24;;
  36.         192.168.1.15)   name="rb2011";          subnet=192.168.25.0/24;;
  37.         *)              logger -t ip-down "unknown ip $ip"; exit 1;;
  38. esac
  39.  
  40. echo ".   `date` -- Disconected -- User:      $name"
  41. echo ".   `date` -- Disconected -- Subnet:    $subnet"
  42. echo ".                                                -- Duration: $duration"  # shows "Duration" but no time...
  43. echo ".................................................................................."
  44.  
  45. #ip link set $dev alias "$name"               # <----i dont understand or is not working is this good ?
  46. #ip route del "$subnet" via $ip               # <----i dont understand or is not working is this good ?
  47. #ip route del "$subnet" via $ip dev $1        # <----i dont understand or is not working is this command good ?
  48. #
  49. logger -t ip-down "routes" to "$name"         #<----i dont understand or is not working is this command good ?
  50.  
  51. exit 0
  52.  
  53. secs2hms() {
  54.         local -i t=$1 w=0 d=0 h=0 m=0 s=0
  55.         s=$[t % 60]; t=$[(t - s) / 60]
  56.         m=$[t % 60]; t=$[(t - m) / 60]
  57.         h=$[t % 24]; t=$[(t - h) / 24]
  58.         d=$t
  59.         if (( d > 0 )); then
  60.                 echo "${d} d ${h} hr"
  61.         elif (( h > 0 )); then
  62.                 echo "${h} hr ${m} min"
  63.         else
  64.                 echo "${m} min ${s} sec"
  65.         fi
  66. }
  67.  
  68.