Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

snowday.sh
2007年 1月 22日 月曜日 19:50:15 MDT 

  1. #!/bin/bash
  2. #snow delay/closing parser program
  3. #Kyle Bassett, Chris Merck
  4.  
  5. clear
  6. echo "SNOWDAY Auto-TXTer V 0.1"
  7. echo "By Kyle Bassett and Chris Merck"
  8.  
  9. #----DIR location for snowday----:
  10. cd ~/snowday
  11.  
  12. #this file must have an empty last line
  13. file_txt_clients="./email_clients"
  14. http_vtsd="URL OF WEBSITE TO BE PARSED"
  15.  
  16. #time to wait to rec'v and parse file
  17. timedelay=60
  18. #time to stop txt msgs
  19. timestopdelay=100000
  20. #txtmsg body:
  21. txtbody="School District-KBass's SnoInfo-reply STOP.SNOW to cancel.  Have fun! `date`"
  22.  
  23.  
  24. #infinite loop, stop for delay/closing
  25. while [ "" = "" ]
  26. do
  27.  
  28. #----------get page to parse-----------
  29. lwp-download $http_vtsd ./vtsd
  30.  
  31. #----------parse page------------------
  32. closed=`cat ./vtsd/index.html | grep -i closed | wc -l | cut -f 2`
  33. delay=`cat ./vtsd/index.html | grep -i delay | wc -l | cut -f 2`
  34.  
  35. msg=""
  36. #for debugging:
  37. #msg="no delay / closing yet!"
  38. if [ $delay = 1 ]
  39. then
  40. msg="Delayed Opening"
  41. echo "Delayed Opening"
  42. timedelay=$timestopdelay
  43. fi
  44.  
  45.  
  46. #closed=0
  47. #msgcountperday=2
  48.  
  49.  
  50.  
  51.  
  52. if [ $closed = 1 ]
  53. then
  54. timedelay=$timestopdelay
  55. msg="School is Closed"
  56. echo "School is Closed"
  57. fi
  58.  
  59. if [ "" != "$msg" ]
  60. then
  61.  
  62. #determine the number of lines in the file
  63. #this is the number of ppl to send to,
  64. # each line being another email address or vtext addr
  65.  
  66. lines=`wc -l $file_txt_clients | cut -d " " -f 1`
  67. echo "email_clients contains $lines clients."
  68.  
  69. lineindex=$lines
  70.  
  71. until [ "$lineindex" = "0" ]
  72. do
  73.  
  74. #send the top line in a text message
  75. email=`tail -n $lineindex $file_txt_clients | head -n 1`
  76.  
  77. #create command file to carry out SMTP transaction
  78. echo "HELO ksb" > tmp
  79. echo "MAIL FROM: snowday@cipercast.net" >> tmp  #you can make this anything!
  80. echo "RCPT TO: $email" >> tmp
  81. echo "DATA" >> tmp
  82. echo "Subject: $msg" >> tmp
  83. echo $txtbody >> tmp
  84. echo "." >> tmp
  85. echo "QUIT" >> tmp
  86.  
  87. #send message over an smtp relay
  88. netcat smtp.find_your_own_mail_relay.net 25 < tmp
  89.  
  90. #update our index number
  91. let "lineindex -= 1"
  92. echo "lines left: $lineindex"
  93.  
  94. done
  95. fi
  96.  
  97. rm ~/snowday/vtsd/index.html
  98. sleep $timedelay
  99.  
  100. done

advertising

ポストを更新

このポストは更新できる、または、新しいポストを作成

You may also comment on this post.

ペーストの更新
ポストの詳細 (随意)

注目: ペーストのコンテントだけで必要ですが、以下の情報は便利かも知れません。

名前/タイトルを保存する?

(スペースで切る, 随意)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

fantasy-obligation fantasy-obligation worth-right