diff --git a/README.md b/README.md index 30d1b76..8d128c8 100644 --- a/README.md +++ b/README.md @@ -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 + diff --git a/conservers.config b/conservers.config new file mode 100644 index 0000000..5b88c34 --- /dev/null +++ b/conservers.config @@ -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" diff --git a/conservers.sh b/conservers.sh index 77d161a..010339b 100755 --- a/conservers.sh +++ b/conservers.sh @@ -1,7 +1,6 @@ #!/bin/bash -# SSH_KEY="$HOME/.ssh/" | 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 @@ -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 diff --git a/getServers.rb b/getServers.rb index 8d66eb9..c0c0248 100644 --- a/getServers.rb +++ b/getServers.rb @@ -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 diff --git a/install.sh b/install.sh index 04e8178..d960f00 100755 --- a/install.sh +++ b/install.sh @@ -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/