Home > Máy tính > Add startup script for CentOS

Add startup script for CentOS

January 16th, 2011 Leave a comment Go to comments

If you have a script my_service and you want it to run at startup, 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)

(Source: http://forums.whirlpool.net.au/archive/894955)

  1. No comments yet.
  1. No trackbacks yet.