Why are post-up commands in /etc/network/interfaces ran multiple times at boot?
12
votes
3
answers
68333
views
Here is the content of
As suggested bellow I have modified my interfaces file as follow (removed the empty lines above post-up): auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp post-up /etc/network/if-up.d/sshstart And added the following line to sshstart: echo $(date)>>/run/shm/sshstart.log Here is the content of
/etc/network/interfaces
:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
post-up /etc/network/if-up.d/sshstart
And sshstart
is a script with the following in it:
curl something something darkside send a file over ftps in the background &
/usr/bin/autossh -M 0 -f -N -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -R 127.0.0.1:2005:127.0.0.1:22 -R 192.168.1.10:2006:192.168.2.110:1912 -L 127.0.0.1:5249:192.168.1.212:5249 username@17.16.15.2 -p 8080
When the machine reboots, the curl
command is executed multiple times, the file ends up 2 or 3 times on the ftp server and when I look at the processes it seems like there are multiple instances of autossh running... Not sure if this is how autossh does things or not, but for sure curl shouldn't upload the file multiple times.
My hunch is that the whole sshstart
script is ran multiple times but I don't understand why.
I tried searching for details on the network setup process at boot but all I could find was syntax information for the interfaces file.
Can someone help please?
Thank you.
**---Edit---**As suggested bellow I have modified my interfaces file as follow (removed the empty lines above post-up): auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp post-up /etc/network/if-up.d/sshstart And added the following line to sshstart: echo $(date)>>/run/shm/sshstart.log Here is the content of
/run/shm/sshstart.log
after a reboot:
Wed Oct 29 08:07:00 EDT 2014
Wed Oct 29 08:07:07 EDT 2014
Wed Oct 29 08:07:07 EDT 2014
Wed Oct 29 08:07:07 EDT 2014
So its been ran 4 times :( what's going on?
Asked by TCZ8
(1109 rep)
Oct 28, 2014, 06:25 PM
Last activity: Oct 30, 2023, 05:23 PM
Last activity: Oct 30, 2023, 05:23 PM