How To: Autoexec.bat in Linux

By Angsuman Chakraborty, Gaea News Network
Sunday, October 14, 2007

Autoexec.bat is a legacy file in Windows which is executed every time you start Windows. Commands you want to run with startup of windows, and applicable to all users, are added to autoexec.bat. Let’s see how you can do the same with Linux.

First of all Linux provides a powerful mechanism to create startup scripts which can be used for complex purposes. For simple scripts to be included during startup like using autoexec.bat on windows, you have a simple alternative:

Include your scripts in /etc/rc.local file.

For example to add a default load balancing route for our outgoing traffic using our dual internet connections (ADSL broadband connections from BSNL & Tata Indicom) here are the lines I included in rc.local file:

ip route add 192.168.1.0/24 dev eth1 src 192.168.1.10 table bsnl
ip route add default via 192.168.1.1 table bsnl
ip route add 192.168.0.0/24 dev eth2 src 192.168.0.10 table tata
ip route add default via 192.168.0.1 table tata
ip rule add from 192.168.1.10 table bsnl
ip rule add from 192.168.0.10 table tata
ip route add default scope global nexthop via 192.168.1.1 dev eth1 weight 1 nexthop via 192.168.0.1 dev eth2 weight 4

Discussion
January 18, 2009: 12:25 pm

[...] you can get Trojans on > it]. Perhaps they’ll have a go at autoexec.bat next. Certainly, Sir: https://blog.taragana.com/index.php/a…cbat-in-linux/ (Linux desktop environments slavishly copying all of Windows’ bad points is a rant reserved for [...]

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :