2

I want to start a java program ( class ) when the system starts ( even though when no user has logged in the system ). I read some documentation and I found that Linux executes the init command when booting and executes the scripts in the rc.d directory. And the rc.local file is executed last. So I wonder if it is right to edit this file in order to run an application when the system has finished booting up ?

1 Answers1

1

It depends. If your program

  • is a purely local modification and
  • you don't need daemon control over the software (start/stop it later at system run) and
  • a simple SIGTERM suffices to stop your program on system shutdown,

then yes, rc.local is just the point to put it.

If you intend to install the file on other systems, put a file in /etc/init.d and use the system specific commands to let it run at the appropriate runlevels.

thiton
  • 35,651
  • 4
  • 70
  • 100
  • is chkconfig good ? for example `chkconfig --add level 3 myService` –  Nov 11 '11 at 13:01
  • @AndyFrédéric: This is often system-dependent, and you are opening up a wholly different barrel here. Better ask a new question on an appropriate StackExchange, e.g. Unix. – thiton Nov 11 '11 at 13:03