Results 1 to 5 of 5
Thread: Run commands on each boot
Enjoy an ad free experience by logging in. Not a member yet? Register.
Run commands on each boot
1. ssh -f -N -D 0.0.0.0:1080 localhost
2. iptables -A INPUT --src 184.108.40.206 -p tcp --dport 1080 -j ACCEPT
3. iptables -A INPUT -p tcp --dport 1080 -j REJECT
these should ensure the server will serve as a proxy at port 1080 for mentioned IP only
Most distros have a startup script called rc.local, where you put this kind of thing. You'll find it in the /etc tree, usually in /etc/rc.d with the other startup scripts."I'm just a little old lady; don't try to dazzle me with jargon!"
i inputed it by installing sshpass (yum install sshpass) and command looks like:
sshpass -p "$pass" ssh -f -N -D 0.0.0.0:1080 localhost
i added commands in a new .sh file with chmod +x permissions and call this .sh file from /etc/rc.d/rc.local (sh /path/to/file.sh) that worked.
Last edited by postcd; 01-25-2014 at 11:03 AM.
- Join Date
- Dec 2013
- Victoria, B.C. Canada
Here's a pretty good explanation of the services execution process at boot. An introduction to services, runlevels, and rc.d scripts | Linux.com
Note it differs by distro - and you haven't indicated yours yet. You get different services at different run levels.
Have you tried just putting those command in the rc.local file and see if they execute. You're running a shell within a shell that's what concerns me.