How to run .sh script (iptables commands) on start up
emmalee last edited by
I am using LineageOS 18.1
When I was on LOS 16, I used to edit the file
/system/etc/init.d/00bannerand put my iptables commands there, e.g.:
#!/system/bin/sh sh -c 'iptables -A OUTPUT -m owner --uid-owner 10195 -d 18.104.22.168/23 -j REJECT'
All iptables commands I put in there used to run on phone start up. But in LOS 18.1, the
/system/etc/init.d/directory was deprecated.
1. I created and filled the custom script with the iptables commands above:
touch /system/etc/custominit.sh chmod 0755 /system/etc/custominit.sh
2. Then I edited
/system/etc/init/hw/init.rcand I added to the end:
chmod 0755 /system/etc/custominit exec /system/etc/custominit
3. I also tried adding:
service custominit /system/bin/custominit.sh disabled oneshot
But none of this worked.
What is it that I doing wrong? I have root access but I do not want to install any additional apps on my phone for this, as it was possible to do on LOS 16.
Laycee last edited by
Issue was solved by following instructions here:
The main issue turned out to be missing full path of executables, e.g.:
/system/bin/iptables instead of iptables