barce / sitebeagle

Sitebeagle tells you when a website has changed or if it's down. (newLISP)

This URL has Read+Write access

sitebeagle / checksite.lsp
100755 63 lines (50 sloc) 1.266 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/newlisp
 
 
(load "sitebeagle.lsp")
(load "twitter.lsp");
 
(set 'params (main-args))
(if (< (length params) 3)
  (begin
    (println "USAGE: checksite.lsp url repeats")
    (exit)
  )
)
 
(set 'url (nth 2 params))
; repeats - # of repeat alerts to send once an alert is tripped
(set 'repeats (nth 3 params))
(set 'startdate (date))
 
(println "----[ Sitebeagle is checking your site ]----")
(new Sitebeagle 'snoopy)
(set 'snoopy:url (string url))
(println snoopy:url)
(println (snoopy:getmd5))
(snoopy:pollurl)
 
(println "sending tweet...")
(new Twitter 'tweet)
 
;
; TODO: find a way to just put this info into YAML
;
 
;
; EDIT BELOW: this is the account you use to send tweets
;
(set 'tweet:user "noobwatcher")
(set 'tweet:pass "PASS")
 
;
; EDIT BELOW: this is the account you use to receive tweets
;
; TODO: change code to support a list of twitter accounts
(set 'tweet:recipient "barce")
 
;
; send the tweet
;
(until (> iter (int repeats))
(tweet:dm (string "sequnce (" (int iter) ") something changed: " snoopy:url))
  (println "sending tweet alert sequence: " (int iter))
(println "something changed: " snoopy:url)
(println "startdate:")
(println startdate)
(println "enddate:")
(println (date))
  (inc iter)
  (sleep 15000)
 
) ; end until
 
(exit)