I have installed iptables-persistent on my Ubuntu 18.04 server and search for a solution that I don't need to save the iptables configuration (iptables-save > /etc/iptables/rules.v4) every time before a reboot or shutdown.
So I created the following script (/etc/init.d/iptables-save) with the command and made it executable.
#!/bin/sh iptables-save > /etc/iptables/rules.v4
After that I created a link in /etc/rc6.d:
ln -s /etc/init.d/iptables-save /etc/rc6.d/K01iptables-save
Now it should be executed before a shutdown, but it doesn't work.
Why doesn't that work? Is there another way to execute this one command before a shutdown/reboot?