shell - How start a script or command during the fedora startup -


i try 2 or 3 hours , exec command script during boot of fedora 23.

i see tutorials chkconfig on fedora, have systemctl, chkconfig old no ?.

i try create service when exec : systemctl enable my_service after reboot , not exec service. manually systemctl start my_service works.

but more weird it's service starts because when write systemctl list-unit-files –type=service , see iptablesvpn.service enable . don't understand why command inside script not executed or maybe soon, don't know :/

so trieda other solution add script in /etc/init.d/script.sh chmod +x on it. not work.

i want restore iptables after reboot. want like: /sbin/iptables-restore /etc/firewall.rules. after boot, if write command in terminal, work , vpn happy if don't write command vpn not work.

so if can me exec command line , happy because seems simple it's not me :/. thank

this process work if it's not optimized script shell @ boot :

1) iptables -f
iptables -p input accept
iptables -f
iptables -a input -i lo -j accept
iptables -a input -m state –state established,related -j accept
iptables -a input -p tcp –dport 22 -j accept
iptables -p input drop
iptables -p forward drop
iptables -p output accept
iptables -l -v

2) edit /etc/sysconfig/iptables-config , put "yes" instead of "no" iptables save options on fedora stop , restart

3) create script shell in /etc/rc.d/rc.local write service iptables restart , it's :)

you see useless or weird in process ?


Comments