How do i run a script on startup?

How do i run a script on startup?

If you choose to make it a normal startup script then the procedure for CentOS is as follows:

1. Put 2 comments into your script:
# chkconfig: 2345 90 10
# description: my_service - does this and that


Where the chkconfig line is the most important, it lists a. 2345 - runlevels the service will be started (by default), b. 90 - when the service is started when entering a runlevel (relative to others, look into /etc/rc3.d for example), c. 10 - when the service is stopped (relative to others, see /etc/rc0.d for example)


2. put your script into /etc/init.d, make it executable (usually chmod'ed to 755)
3. As root run "chkconfig --add my_service (if you put it in /etc/init.d/my_service)

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How do i disable IPV6 on Cent OS

disable ipv6 on centos then you can do this :-Log in via ssh and type this :-service ipv6tables...

4gb seg fixup,how to solve (CentOS)

Xen DomU: 4gb seg fixup, process A common error on a Xen DomU (as well as Dom0) in...

How can I add more CentOS repositories?

How can I add more CentOS repositories? It is possible to add more repositories that are...

How can I find the Cent OS version?

To check which release your are running you can type this into the console (bash / shell) via SSH...

How can i show my cpu info (linux)?

How can i show my cpu info? Log in to your server via SSH then typ;e the following command...