How to create startup script on Debian

Tags: 

Debian

Today I have a problem that I have to add routing to my debian test box every time that server start so I googling and found this

This method I think it is only work on Debian based distro and I not sure about Redhat based distro

First create file in /etc/init.d/. For me I create route file for routing script.

vi /etc/init.d/route

Then put your Bash shell script. This example is my routing script

#!/bin/bash
/sbin/route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.150.254
/sbin/route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.150.254

Run these last commands to run the script every time server start.

chmod +x /etc/init.d/route
update-rc.d route defaults

route is the name of your bash shell script