0

I wrote a script to run a traceroute on a series of ip ranges. When I use the default options (that is, when I run traceroute without any additional options), my script runs fine. In other words:

traceroute "$hostip" 

Produces the desired result.

However when I utilize the options I need, traceroute fails to run, stating no host has been provided:

traceroute -p 25 -M tcp "$hostip"
Specify "host" missing argument.

I'm really at a loss. I've tried a couple different combinations, none of which work. I'm failing to comprehend why this command works in the first fashion, but not with options enabled!

I have traceroute-2.0.19-x86_64-1 on slackware64-current. Any help is greatly appreciated!

Here is a shortened version of what i'm working with:

#!/bin/bash
#
# tracert_efax-smtp.sh
#
# Diego Pineda 8132015

# output
foi='1'
fp='/home/slugman/Data'
fileo="$fp/tracert_efax-smtp.$foi"


# while loop 181 - 183
ip1a="216.24.224."
ip1b="181"


# Create fileo
if [ -e $fileo ]; then
        (( foi++ ))
        fileo="$fp/tracert_efax-smtp.$foi"
        touch $fileo
else
        touch $fileo
fi


# test ip1 series
echo "Testing $ip1a$ip1b - 183" >> $fileo
while [ $ip1b -le 183 ]; do
        traceroute -p 25 -M tcp "$ip1a$ip1b" >> "$fileo"
        (( ip1b++ ))
done
slugman
  • 29
  • 7
  • Did you check space between arguments ? (to make sure there are no escape character or anything) – Bertrand Martel Aug 13 '15 at 19:09
  • Betrand, there are no spaces in between the arguments, escape characters, or any other extraneous tokens which would cause unexpected behavior. – slugman Aug 13 '15 at 19:16
  • Cyrus--script added! – slugman Aug 13 '15 at 19:21
  • 1
    Your script doesn't provide the `tcp` argument to the `-M` option. – chepner Aug 13 '15 at 19:27
  • woops, pasted too fast! Either way, with tcp it still isn't producing the desired effect... it works just fine with no options, but I really need it to utilize the given options (testing smtp servers) – slugman Aug 13 '15 at 19:29
  • 1
    Your current script works fine for me on RedHat. – dg99 Aug 13 '15 at 21:49
  • well, that is good to know! I'll see if I can rebuild traceroute from source, and start looking in that direction. Otherwise, I guess I'll just run the script from a cent box and get the required data that way. Still, I'd like to know the reason this doesn't work--this is a ridiculous quirk! – slugman Aug 13 '15 at 22:28
  • I just executed your script on slackware64-current. Im using same version of traceroute (traceroute-2.0.19-x86_64-1). And its work fine for me. Are you execute your script as root user? – Murad Tagirov Aug 14 '15 at 08:59

0 Answers0