Monday, September 28, 2009

Start An Application When Linux, RedHat, Starts

Here you go:
  • Create a control script in /etc/init.d folder that responds to at least start and stop commands.
  • In this script, include a comment line: chkconfig 35 80 20 (there is a meaning to it: for which runlevels the process is to be off or on).
  • Run the chkconfig --add your_control_script command. Run it with --list option to verify that the control script has been added to the list of processes to start at boot time.
  • If there are any problems during boot time, they are recorded in the /var/log/boot.log and/or /var/log/messages files.
Note:
Global environ variables are usually defined in the /etc/profile script. This script is automatically run by every interactive shell process (or a shell process with --login argument). The /etc/profile doesn't seem to be executed automatically during the boot process, though. You may need to do:
. /etc/profile
in your control script if you need to use any of the global environ variables.

No comments: