Create a script file(batch) on linux

1. Create new file with editors, vi, pico, nano and so on.

Linux_Srv> pico script_batch

 

2. Edit the file

#! /bin/sh or #! /bin/bash (whatever you are currently using shell)
ifconfig eth0 192.168.11.1
:
:
[whatever you want to execute when system bootup]

 

3. Save

 

4. Make it executable

Linux_Srv> chmod +x script_batch

 

5. Copy the file to /etc/init.d/

Linux_Srv>cp script_batch /etc/init.d/

 

6. Update the system

Linux_Srv>update-rc.d script_batch defaults

 

7. Reboot the system and the script will be automatically executed.

 

 

Leave a Reply