Skip to content

Commit

Permalink
Added checks
Browse files Browse the repository at this point in the history
Added checks for needed commands and existance of config file.
  • Loading branch information
OranJuiceJohnes committed Jan 12, 2015
1 parent da10330 commit 17f2f04
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion nsupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

##################
# check required #
##################
command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; }
command -v awk >/dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Note: all needed items are listed in the README.md file."; exit 1; }
command -v drill >/dev/null 2>&1 || command -v nslookup >/dev/null 2>&1 || { echo >&2 "I need drill or nslookup installed. Note: all needed items are listed in the README.md file."; exit 1; }
##################
# check config #
##################
if [ ! -f nsupdate.d/*.config ]; then
echo "There does not seem to be ready to be used config file available." ; exit 1;
fi
##################

LOG=$0.log

# Loop through configs
Expand Down Expand Up @@ -102,4 +116,4 @@ do
unset INWX_PASS
unset INWX_USER
unset INWX_DOMAIN_ID
done
done

0 comments on commit 17f2f04

Please sign in to comment.