Skip to content

Commit

Permalink
Create config file #4
Browse files Browse the repository at this point in the history
  • Loading branch information
brfso committed Aug 23, 2014
1 parent 5d68deb commit d88ef3d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ Notes: Mac Users can install wget using this is how to: http://osxdaily.com/2012

##How to Use##

1. Set SSH Key in SSH_KEY in coserver.sh
2. Change Page to connect (url) in getServers.rb
1. Set SSH Key in SSH_KEY in /etc/conservers.config
2. Change Page to connect (url) in /etc/conservers.config
3. Execute conServers.sh
conservers.sh
####To Update Server List
To update server list from html page, execute with option -a:
conserver.sh -a

##toDO##
1. Support connections to windows server (rdesktop, etc)
2. Support to automatic HTML Page update from servers
3. Add Auth HTTP as Option
4. Change parameters to config file
5. Add Automatic detect changes in HTML PAGE and update CSV file
To view or make one request use: https://github.com/brfso/conServers/issues

10 changes: 10 additions & 0 deletions conservers.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Configuration File

# Sample: URL= http://www.yoursite.com/servers
URL=

# If you not use ID_RSA, change it
SSH_KEY="$HOME/.ssh/id_rsa"

# Temporary file generated by conserver
SERVERS_LIST="/tmp/servers.csv"
7 changes: 3 additions & 4 deletions conservers.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash
# SSH_KEY="$HOME/.ssh/<KEY>" | SAMPLE: SSH_KEY="$HOME/.ssh/id_rsa"
SSH_KEY="$HOME/.ssh/id_rsa"
SERVERS_LIST="/tmp/servers.csv"

. /etc/conservers.config

function return_code() {
if [ $? -eq 1 ]; then
Expand All @@ -23,7 +22,7 @@ if [ ! -f "$SERVERS_LIST" ] || [ "${1}" == '-a' ];
do
read -s -p "Digite a senha do seu usuário da WIKI: " PASSWORD
done
ruby /usr/bin/getServers.rb ${USERNAME} ${PASSWORD}
ruby /usr/bin/getServers.rb ${USERNAME} ${PASSWORD} ${URL}
return_code
fi

Expand Down
4 changes: 1 addition & 3 deletions getServers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
username = "#{ARGV[0]}"
password = "#{ARGV[1]}"

# SAMPLE: uri = URI("http://www.youwebsite.com/servers.html")

uri = URI("http://")
uri = URI("#{ARGV[2]}")
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth username, password

Expand Down
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fi
bundle install

sudo cp $PWD/conservers.sh /usr/bin/
sudo cp $PWD/conservers.config /etc/
sudo cp $PWD/getServers.rb /usr/bin/


0 comments on commit d88ef3d

Please sign in to comment.