#!/bin/bash local_time=$(date +%Y-%m-%d\ %H:%M:%S) timestamp=$(date +%s) hostname=`hostname` role=$1 testFileName="testFile-1G" function createTestFile(){ dd if=/dev/urandom of=/var/tmp/$testFileName count=1 bs=1G status=progress } if [[ $1 == "server" || $1 == "client" ]]; then echo "setting role to $role" # debian # Get IP address of a specific interface (replace eth0 with your interface name) # ip_address=$(ip addr show ntb0 | grep 'inet addr' | awk '{print $2}' | cut -d '/' -f 1) # freebsd # Get IP address using ifconfig # ip_address=$(ifconfig ntb0 | grep 'inet.*' -m 1 | awk '{print $2}' | cut -d ':' -f 2 | cut -d ' ' -f 1) else echo "must run with client/server argument" exit fi if [[ $role == "server" ]]; then echo "Please enter IP address to host Server:" read ip_address echo "Server will start on: $ip_address" fi if [[ $role == "client" ]]; then echo "What is the IP address of Server:" read ip_address echo "" echo "Attempting to ping server...." ping -c 2 $ip_address echo "" echo "If the pings failed, you may cancel now, or press enter to continue" read continue echo "" echo "Creating /var/tmp/$testFileName" createTestFile echo "" echo "Listing TestFile" ls -lah /var/tmp/$testFileName echo "" echo "Listing SMB Shares on Server" smbclient -L $ip_address fi #read testSMB # smb testing # get share name # nfs testing # dd/pv testing