-
-
Save bjhaid/6684000 to your computer and use it in GitHub Desktop.
require 'oci8' | |
f = File.open("/home/bblite/ported/portedmsisdn.txt") | |
conn = OCI8.new(DB_USER, DB_PASSWORD, DB_SERVER) | |
conn.autocommit = true | |
f.each_line do |msisdn| | |
#I think you would need to validate the MSISDN against a particular regular expression | |
next unless msisdn.match(/^233\d{9}/) | |
#replace the port with the SDP server port | |
`curl 127.0.0.1:8051/blackberry/smsservice?msisdn=#{msisdn.chomp}&msg=deactivate` #you need to deactivate the msisdn on Broker | |
conn.exec("delete from subscriber where = '#{msisdn.chomp}'") #msisdn would have a new line character behind it so you would want to remove the new line | |
conn.commit | |
end | |
conn.logoff | |
#you need to think of a folder they can drop into and we monitor it, or you would have to put this on cron job that runs every 5 minutes and they should be dropping them in a folder then you process all the files in a folder, and move failed and successfull as need be to where they should be. |
Warning: NLS_LANG is not set. fallback to US7ASCII.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2642 100 2642 0 0 311k 0 --:--:-- --:--:-- --:--:-- 0
stmt.c:235:in oci8lib_191.so: ORA-00920: invalid relational operator (OCIError)
from /home/bblite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/oci8/oci8.rb:447:in exec' from /home/bblite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/oci8/oci8.rb:255:in
exec_internal'
from /home/bblite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/oci8/oci8.rb:248:in exec' from ported.rb:16:in
block in
from ported.rb:11:in
each_line' from ported.rb:11:in
'
1 require 'oci8'
2
3
4 DB_USER='bblite'
5 DB_PASSWORD='bblite'
6 DB_SERVER='//10.93.85.85:1521/bblite'
7
8 f = File.open("/home/bblite/ported/portedmsisdn.txt")
9 conn = OCI8.new(DB_USER, DB_PASSWORD, DB_SERVER)
10 conn.autocommit = true
11 f.each_line do |msisdn|
12 #I think you would need to validate the MSISD{N against a particular regul ar expression
13 next unless msisdn.match(/^233\d{9}/)
14 #replace the port with the SDP server port
15 curl 10.93.85.84:8017/blackberry/smsservice?msisdn=#{msisdn.chomp}&msg=de activate
#you need to deactivate the msisdn on Broker
16 conn.exec("delete from subscriber where #{msisdn.chomp}") #msisdn would ha ve a new line character behind it so you would want to remove the new line
17 conn.commit
18 end
19
20 conn.logoff
:set number
ORA-00920: invalid relational operator (OCIError) there was = missing between where and msisdn
you need to think of a folder they can drop into and we monitor it, or you would have to put this on cron job that runs every 5 minutes and they should be dropping them in a folder then you process all the files in a folder, and move failed and successfull as need be to where they should be.