0

I have a tftp script here that when run it just hangs and brings me to a blank line (which tells me it's hanging). I can quit the script by Ctrl+C...

#!/bin/bash
hostname=$1;
filename=$2;

tftp <</dev/null
mode binary
get $hostname:$filename
quit

I have also tried to add EOF at the end of the script, but that doesn't work either.

Here is my command line...

$ ./tftpShell.sh host1 myFileName >/home/aayerd200/tftpoutput.txt 2>/home/aayerd200/tftperror.log

So when I run the script, it just leaves me on a blank line. However, it does actually do the work it should with get, I do get the file I want.

Of course host1 and myFileName are actual fields that I replaced here for security.

How can I stop this script? I believe it is just tftp hanging upon $ ps -u aayerd200, or when run by php $ ps -u daemon

harmonickey
  • 1,299
  • 2
  • 21
  • 35

2 Answers2

1

You have /dev/null as a here document "delimiter" Try some random set of characters like EOF that have no meaning to the shell. And terminate the here doc

tftp <<-EOF
mode binary
get $hostname:$filename
quit
EOF
jim mcnamara
  • 16,005
  • 2
  • 34
  • 51
0

Okay so I just made this a background process by appending & to the end of the command. Then I ran $ echo $! for the PID. Then I ran $ kill PID.

That was my solution to this, for now at least.

harmonickey
  • 1,299
  • 2
  • 21
  • 35