From df85ba864ba48bfcb522149d2c12a6183eefc419 Mon Sep 17 00:00:00 2001 From: Marco Vermeulen Date: Sun, 5 Apr 2015 18:14:34 +0100 Subject: [PATCH] Removes obsolete broadcast script. --- bin/broadcast.sh | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100755 bin/broadcast.sh diff --git a/bin/broadcast.sh b/bin/broadcast.sh deleted file mode 100755 index 300db5e3..00000000 --- a/bin/broadcast.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env groovy - -@Grab('org.mongodb:mongo-java-driver:2.11.0') -@Grab('org.vert-x:vertx-core:1.3.0.final') - -import com.mongodb.* -import org.vertx.java.core.json.JsonObject - -if(!args || args.size() > 2){ - println "Usage: broadcast.sh " - return -} - -def config -if(args.size() == 2 && args[1]){ - def mongoConfig = args[1] as File - config = new JsonObject(mongoConfig.text).toMap() -} else { - config = [address: 'mongo-persistor', db_name: 'gvm', host: 'localhost', port: 27017, username: '', password: ''] -} - - -def mongoClient = new MongoClient(config.host, config.port.toInteger()) -def db = mongoClient.getDB(config.db_name) -db.authenticate(config.username, config.password?.chars) - -def collection = db.getCollection('broadcast') - -def removeObject = new BasicDBObject() -collection.remove(removeObject) - -def input = this.args[0] as File -def counter = 1 -println "\nInserting the following into ${config.db_name} at ${config.host} port ${config.port} as user ${config.username}: \n" -input.eachLine { line -> - println "$line" - def dbObject = new BasicDBObject('_id': counter++).append('text', line) - collection.insert(dbObject) -}