0
I am trying to get a file through tftp on boot-up. Tftp server has been properly setup on another machine. I am running tftp get in a shell script like this:
tftp 192.1x.x.110 << !
get file.txt
quit
!
This shell script runs fine when I execute it, and I am able to get the file. I am trying to run it as a systemd service, but when it runs at boot-up it just gives me an empty file.
This is how my systemd service looks like:
[Unit]
Description=Grabbing TFTP file
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/home/debian/./test-tftp.sh
StandardOutput=null
[Install]
WantedBy=multi-user.target
Alias=tftp_file.service
My systemd service also works fine when I start it myself and I get the file with data inside it, but only at boot up its giving me an empty file. So I am thinking maybe I am not starting the service at the right time in the boot process.
Any suggestions would be greatly appreciated. Thank you
Does the tftp tool output any error messages when started as a service on boot? – user1686 – 2019-07-11T14:10:53.703
@grawity No errors. I even tried running service type as "oneshot", and that also didn't change anything. – Sam – 2019-07-11T14:19:08.100
Type=oneshot is more suitable. Does it output anything if you remove StandardOutput=? – user1686 – 2019-07-11T14:21:23.800
@grawity After removing StandardOutput, I can see this error "tftp: sendto: Network is unreachable". Why is network unreachable even if I have After=network-online.target Wants=network-online.target in there. – Sam – 2019-07-11T14:31:07.110