JP Vossen on 15 Jan 2014 13:02:38 -0800


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

Re: [PLUG] debugging an init script


On 01/15/2014 11:49 AM, Andrew Libby wrote:

Hi Carl,

You can probably do something like

/bin/bash -x /etc/init.d/servicescriptname {start|stop}

+1 for that, though all the ideas have been good.

You may also want to play with $PS4 which is the prompt for the -x debug output.

Possibly overkill example (and this looks like negative line numbers when not in a function):
	export PS4+xtrace $BASH_SOURCE::$FUNCNAME-$LINENO:= '

NOTE that the first character is duplicated to indicate nesting level, so make sure it's something that makes sense, like "+".

Lots more here: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/

Later,
JP
----------------------------|:::======|-------------------------------
JP Vossen, CISSP            |:::======|      http://bashcookbook.com/
My Account, My Opinions     |=========|      http://www.jpsdomain.org/
----------------------------|=========|-------------------------------
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug