-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkk47smssend
More file actions
executable file
·50 lines (42 loc) · 1.33 KB
/
kk47smssend
File metadata and controls
executable file
·50 lines (42 loc) · 1.33 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
#!/usr/bin/env python
# dayu short message alert
# You have to change the dayu_Uid,dayu_Key
import os,sys
import getopt
import commands
from urllib import urlencode
if __name__ == "__main__":
try:
opts,args = getopt.getopt(sys.argv[1:],"hp:s:","help")
except getopt.GetoptError, msg:
print msg
sys.exit(1)
for op,value in opts:
if op in ("-h","--help"):
print "Usage : dayu_smssend -p '15216032134 15811233245' -s 'subject'"
sys.exit(0)
elif op == "-p":
dayu_smsMob=value
elif op == "-s":
dayu_smsText=value
else:
print "Usage : dayu_smssend -p '15216032134 15811233245' -s 'subject'"
sys.exit(0)
dayu_smsMob = ','.join(dayu_smsMob.split())
#print dayu_smsMob
dayu_Uid = "aggstor"
dayu_Key = "t54d82aec0abdacyaa4u"
m = {'Uid':dayu_Uid,'Key':dayu_Key,'smsMob':dayu_smsMob,'smsText':dayu_smsText}
url = urlencode(m)
url = 'http://utf8.sms.webchinese.cn/?' + url
if not os.path.exists('/usr/bin/curl'):
sys.exit(1)
cmd = "/usr/bin/curl -v \"%s\"" % url
try:
#print cmd
status,output = commands.getstatusoutput(cmd)
#print status,output
if status != 0:
status,output = commands.getstatusoutput(cmd)
except:
raise