Re: Container has no network
Posted: 03 Mar 2021, 04:10
I didn't automate the route changes after reboot yet, because the NAS is running pretty stable and the uptime is at about 40 days, so yeah. But instead of a cron job, I created a script in /etc/init.d/. The file name should be something like S99zzzmyscript, so that it will load at a later time (when nasips has already been started).
Content of /etc/init.d/S99zzzmyscript:
The script and comments are pretty straight forward. One last thing that would be missing is the change of the routes + ips. But it shouldn't be a problem from there on. The empty file /etc/sc.d/S99zzzmyscript makes sure, that our init.d script gets executed on every boot.
Code: Select all
$ touch /etc/init.d/S99zzzmyscript
$ touch /etc/sc.d/S99zzzmyscript
$ chmod u+rwx /etc/init.d/S99zzzmyscript
$ vi /etc/init.d/S99zzzmyscriptCode: Select all
#!/bin/bash
/usr/bin/logger S99zzzmyscript executed
## rewrite config
/bin/sed -i 's/jumpd = YES/jumpd = NO/g' /etc/nasips.ini
## restart service
/sbin/service S99nasips restart
## is traefik running?
CONTAINERRUNS=`docker inspect -f {{.State.Running}} traefik`
STATUSTRUE=true
if [ "$CONTAINERRUNS" = "$STATUSTRUE" ]; then
/usr/bin/logger traefik runs fine
else
/usr/bin/logger traefik restarted
/mnt/md0/application/bin/docker restart traefik
fi
exit 0