From cde05af0f6f8406177d3075ef29470c46c8c7bfa Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sat, 16 May 2015 01:06:01 +0200 Subject: Add ancient addstatip script This script was used to add static IPs to dnsmasq's dhcp server when running a small experiment cluster thing at school. Import so that it's in the history. --- addstatip | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 addstatip (limited to 'addstatip') diff --git a/addstatip b/addstatip new file mode 100755 index 0000000..6a7c0a2 --- /dev/null +++ b/addstatip @@ -0,0 +1,40 @@ +#!/usr/bin/env zsh + +scriptname=${0##*/} + +usage() { + cat <&2 "Invalid mac address.\n" + exit 1 +fi + +if print $dhosts | grep -q $1; then + printf >&2 "An entry with MAC-address %s already exists.\n" $1 + exit 1 +fi + +if print $dhosts | grep -q $2; then + printf >&2 "An entry with IP-address %s already exist.\n" $2 + exit 1 +fi + +print "$1,$2" >> $dhosts_name +pkill -x -HUP dnsmasq -- cgit v1.2.3-70-g09d2