Linux‎ > ‎

Startup Script


Linux Startup Script


Debian: create the init.d script, placed in /etc/init.d/, then run the following to set it up for automatic startup at boot time.

update-rc.d <script name> defaults 20

Redhat:

chkconfig
[root@bigboy tmp]# chkconfig --list keytable 0:off 1:on 2:on 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off wlan 0:off 1:off 2:on 3:on 4:on 5:on 6:off sendmail 0:off 1:off 2:off 3:on 4:off 5:on 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off random 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Chkconfig Examples

You can use chkconfig to change runlevels for particular packages. Here we see Sendmail will start with a regular startup at runlevel 3 or 5. Let’s change it so that Sendmail doesn't startup at boot. Use Chkconfig To Get A Listing Of Sendmail's Current Startup Options

[root@bigboy tmp]# chkconfig --list | grep mail
sendmail 0:off 1:off 2:off 3:on 4:off 5:on 6:off 

Switch Off Sendmail Starting Up In Levels 3 and 5
[root@bigboy tmp]# chkconfig --level 35 sendmail off

Doublecheck That Sendmail Will Not Startup

[root@bigboy tmp]# chkconfig --list | grep mail sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Turn it back on again

[root@bigboy tmp]# chkconfig --level 35 mail on [root@bigboy tmp]# chkconfig --list | grep mail sendmail 0:off 1:off 2:off 3:on 4:off 5:on 6:off


Comments