skip to Main Content

I want, when my centos 7 server boots, to run

echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse

because I want to reuse open connections.

Systemd is allready installed, but my command is not a service, just a one time execution command at startup.

How can I run automatically this command at startup ? Thanks !

2

Answers


  1. Add your command to

     /etc/rc.d/rc.local
    

    and it will run at startup.

    Login or Signup to reply.
  2. The correct way to make the changes persistent is to edit the file:

    /etc/sysctl.conf
    

    After the change, type:

    sysctl -p 
    

    This will load the changes into the current session. The fact that the settings are in /etc/sysctl.conf will ensure that they load on reboots.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search