Find the answer to your Linux question:
Results 1 to 4 of 4
Im using my Linux server as a router(debian) But every time i restart it i have to type 2 commands to start the routing! but i want it to autoexec ...
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    42

    Auto exec file?

    Im using my Linux server as a router(debian)

    But every time i restart it i have to type 2 commands to start the routing! but i want it to autoexec on startup, if thats extreamly hard i want it to exec on login

  2. #2
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    write the command to a script
    give the run permission to the script and copy it to the /etc/init.d directory
    make a symlink from /etc/rcX.d to the script in the init directory
    X means the runlevel
    each symlinks have this format "S"or"K""ordinal number""name"

    for example:
    the script
    Code:
    #!/bin/sh
    routing command 1
    routing command 2
    exit 0
    save it as routing
    chmod 744 routing
    cp routing /etc/init.d
    the default runlevel is 2
    ln -s /etc/init.d/routin /etc/rc2.d/S90routing

    and its done

  3. #3
    Just Joined!
    Join Date
    Jan 2007
    Posts
    42
    Im such a newbie...... i didnt understand that

    if i want the command "# echo 1 > /proc/sys/net/ipv4/ip_forward" to run every time user "myuser" log in...

    whats the script then?

  4. #4
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    put that line to the .bashrc file in "myuser"s home and it will run run evry time when you log in

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •