automatically starting apps on system boot

zimu

Diamond Member
Jun 15, 2001
6,209
0
0
hey guys,

i just can't get this app to start up automatically.

i've put a script with execute permissions into my /etc/init.d/ folder, and ln'ed it to my rc.d/rc5 directory as S50<myscript>.

no go. and i don't even know where to look in the server logs to see what the issue is?

any help?
 

SleepWalkerX

Platinum Member
Jun 29, 2004
2,649
0
0
Apache? When I installed it, it started up automatically. At least on Ubuntu. What are you trying to run and what distro are you using?
 

zimu

Diamond Member
Jun 15, 2001
6,209
0
0
centos enterprise 5.2.
basically have this daemon i want to run which is run by, for e.g. executing "/home/user1/daemon/daemon start". so what i did was make a executable file that just calls it, e.g. "startit"
so if i type ./startit it works perfect.

then just copied the startit script into the init.d folder, made a symlink into the rc.d. but doesn't run...
 

Kakumba

Senior member
Mar 13, 2006
610
0
0
Try adding it to chkconfig, /sbin/schkconfig --add <name>. You will need to ensure that the script in the init.d directory has these commented lines (preferably near the top for ease of checking..):

# Basic support for IRIX style chkconfig
# chkconfig: 3 91 07
# description: Manages the services needed to run VMware MUI

As you can see, that is from the httpd.vmware script on one of my CentOS 5.2 machines. It is set to start on runlevel 3 only, with start priority 91, and kill priority 07. Add those lines, with changes as necessary, to the init.d script, and then add to chkconfig. Then you can do:

/sbin/chkconfig <name> on
 

crontab

Member
Dec 20, 2000
160
0
0
is this the apache package that is delivered with cent or is this your own unique build? if it's from cent, there should be a service for it, chkconfig to see what run levels it's set to. Sometimes it's called httpd or http-server

If it's not there, i'd recommend that you make it a service, but lets start by seeing why httpd isn't starting.

first, do you source the correct environment before or within your apache startup script?
 

Kakumba

Senior member
Mar 13, 2006
610
0
0
Oops, missed that its apache. Yeah, the standard CentOS apache will show up as httpd definitely under chkconfig --list, so try a chkconfig httpd on.
 

crontab

Member
Dec 20, 2000
160
0
0
yeah, it's not apache, i was thrown off.

but to get back to the issue, is the env sourced in startit
 

zimu

Diamond Member
Jun 15, 2001
6,209
0
0
ok i'm really confused now, how do i do this whole chkconfig thing? and yes - sorry about my thread title, i pointed out its a webserver cause i wanted to say that i don't have some GUI or something where i can just put it into some startup-type-equivalent folder that runs automatically...

crontab: nope. startit literally just has the command to run, a single line. works if i run it from bash, not sure how to set the environment if its being run automatically...
 

crontab

Member
Dec 20, 2000
160
0
0
chkconfig will make your scripts into a service, but they have to prepped for that. first focus on getting the script to run at boot.

what user do you run startit as? Use their profile. Add something like this into your startit

. /home/username/.bash_profile
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Are you booting into runlevel 5? If you don't have the GUI stuff installed I believe runlevel 3 is the default in RH.
 

zimu

Diamond Member
Jun 15, 2001
6,209
0
0
crontab : adding the line didn't help :(

nothinman: how do i check?
 

zimu

Diamond Member
Jun 15, 2001
6,209
0
0
hmm i'll be damned it was runlevel 3.

i put the symlink into rc3.d but still no go on reboot...
 

crontab

Member
Dec 20, 2000
160
0
0
can you add set -x and redirect that output to somewhere in /tmp to see what it's doing or not doing?
 

crontab

Member
Dec 20, 2000
160
0
0
not at the very top

do something like this

#!/bin/bash
set -x
exec > /tmp/output.out 2>&1
date
/home/user1/daemon/daemon start
date

lets see if anything shows up in /tmp/output.out