Eric at on 15 Jan 2014 08:57:31 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] debugging an init script

On 01/15/2014 11:46 AM, Carl Johnson wrote:
> Can someone in PLUG can help me out? My google-fu isn't that strong today.
> I've a Centos 6.5 box that has a service that won't start. Every time I run "service <script name> start" I get a red "[FAILED] message.
> Does anyone have any idea how I can log/watch/debug this script to see why/where it's failing as it runs? Can I redirect the sub-shell output to a logfile somehow? Is there a way to make it send all output to stdout?
> All I know right now is that it's failing. The script doesn't have the logic in it to tell me "xyz.conf is missing....... [FAILED] or that it's failing because it can't write a PID to /var/run" or something like that.

When I (infrequently) do this I look in the script and find the command that it's executing to start the
service (99% of the init.d scripts are boilerplate.)  Research that command and find out how to increase the
verbosity of it's logs.  Make that change to the file (just comment out the actual line and replace it with
your debug line.

For example, replace:
 fooserver ${OPTS}
 fooserver -v ${OPTS}
 fooserver -d 2 ${OPTS}

Then start it.... it still breaks.
Then look in the logs.

Hope that helps... it's worked for me in the past.
#  Eric Lucas
#                "Oh, I have slipped the surly bond of earth
#                 And danced the skies on laughter-silvered wings...
#                                        -- John Gillespie Magee Jr
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --