- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Would appreciate debugging tips for SD configure s...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:02 AM
09-01-2008 03:02 AM
Would appreciate debugging tips for SD configure script
I try to swpackage a Nagios NRPE build.
Because service needs to be registered,
group and user added and inetd reconfigured
I provided a configure/unconfigure script
in which I cannot find a syntax error.
There must be some garbage in the configure file however.
Though I tried "cat -e configure" and "xd -t a configure" I cannot find the following number LF sequences that seem to cause the syntax error.
When I run
# swconfig NagiosNRPE.ALL
in swjob's log it failed with this line
/var/adm/sw/products/NagiosNRPE/ALL/configure[23]: 27^J35^J40^J52^J59^J75^J91^J1
01^J102^J109^J112: Syntax error
I slightly modified the script to use $$ instead o jobid parsed from $SW_SESSION_OPTS to be able to run the script from the interactive shell as well.
So when I set -x and provide the minimally required SW environment I get the same result.
# SW_PATH=/usr/bin SW_SOFTWARE_SPEC=NagiosNRPE.ALL,bla SW_CONTROL_TAG=configure /var/adm/sw/products/NagiosNRPE/ALL/configure
+ export PATH=/sbin:/usr/sbin:/usr/bin
+ + uname -n
NODE=elba
+ fileset=NagiosNRPE.ALL
+ [[ -n ]]
+ JOBID=7896
+ [[ NagiosNRPE.ALL = NagiosNRPE.ALL ]]
+ eval_response
+ : 5666
+ 1>& 2
+ has_listen_socket 5666
+ configure_inetd
/var/adm/sw/products/NagiosNRPE/ALL/configure[23]: 27^J35^J40^J52^J59^J75^J91^J101^J102^J109^J112: Syntax error
Is there a better way to debug this?
- Tags:
- control scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:11 AM
09-01-2008 03:11 AM
Re: Would appreciate debugging tips for SD configure script
Is configure_inetd a function?
You'll need to insert "set -x" in each function you use.
(I don't know if "#!/sbin/sh -x" will work for the whole script?)
The error looks like you are doing: $(< file)
With a missing command in the front.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:13 AM
09-01-2008 03:13 AM
Re: Would appreciate debugging tips for SD configure script
would anything prohibit writing those swpackage scripts in Perl?
I really cannot find a compelling reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:19 AM
09-01-2008 03:19 AM
Re: Would appreciate debugging tips for SD configure script
yes, configure_inetd is a func,
and yes, I haven't put -x in every func's body.
I think the reference to line 23 is bogus.
There isn't something evil around it.
Only my quick fix for an undefined $SW_SESSION_OPTIONS, which is merely an ephemeral file provided in swconfig's context.
# cat -n -e -t /var/adm/sw/products/NagiosNRPE/ALL/configure|sed -n 20,25p
20 if [[ -n $SW_SESSION_OPTIONS ]]; then$
21 JOBID=$(awk -F'[= ]' '$1=="jobid"{print$2}' $SW_SESSION_OPTIONS)$
22 else$
23 JOBID=$$$
24 fi$
25 $
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:25 AM
09-01-2008 03:25 AM
Re: Would appreciate debugging tips for SD configure script
>I really cannot find a compelling reason.
Several:
1) Perl may not be installed on all systems.
2) You need /sbin/sh when /usr/ isn't mounted.
3) How will you use the functions in /usr/lbin/sw/control_utils?
4) You shouldn't be writing buggy shell code. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:25 AM
09-01-2008 03:25 AM
Re: Would appreciate debugging tips for SD configure script
Have you tried with SDU_DEBUG options?
Try to export to appropriate level (1-4) and after that try swconfig commands.
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:36 AM
09-01-2008 03:36 AM
Re: Would appreciate debugging tips for SD configure script
It may mean line 23 in that function. What were the lines for:
+ has_listen_socket 5666
+ configure_inetd
>Ivan: Have you tried with SDU_DEBUG options?
I'm not sure that is any better than "set -x" or "#!/sbin/sh -x". And it probably equal to the latter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:45 AM
09-01-2008 03:45 AM
Re: Would appreciate debugging tips for SD configure script
no I haven't yet come across SDU_DEBUG.
Can't remember to have seen it in any of the manpages.
That thing is quite nice.
But I think it is rather addressed at the developers of SD utils and not the user to debug their crappy scripts.
Even with highest flag it doesn't produce more hints related to the script error.
# SDU_DEBUG=4 swconfig NagiosNRPE.ALL 2>&1|grep ERR
ERROR: "elba:/": 1 configure or unconfigure scripts failed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 03:57 AM
09-01-2008 03:57 AM
Re: Would appreciate debugging tips for SD configure script
I admit, probably too contrived
where a mere grep would have done.
has_listen_socket() {
netstat -an -f inet \
| awk -v p=${1:-5666} 'BEGIN{rc=1}; \
$1=="tcp"&&$NF=="LISTEN"&&a[split($4,a,".")]==p{rc=0;exit}; \
END{exit rc}'
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 04:18 AM
09-01-2008 04:18 AM
Re: Would appreciate debugging tips for SD configure script
which makes me suspect that the failure could have been cause by an absent response file.
I provided my script with a request block
which of course only gets executed when swinstall or swconfig is run with -x ask=true.
So this time I invoked swconfig with that option an confirmed my request defaults.
This time all has been configured to my delight and inetd started the new service.
[root@elba:/root]
# netstat -an|grep 5666
tcp 0 0 *.5666 *.* LISTEN
[root@elba:/root]
# id nagios
uid=103(nagios) gid=102(nagios)
[root@elba:/root]
# grep nagios /etc/passwd
nagios:*:103:102:NRPE user added by SD elba-0089:/var/opt/nagios:/usr/bin/sh
[root@elba:/root]
# grep nrpe /etc/{services,inetd.conf}
/etc/services:nrpe 5666/tcp # Nagios Remote Plug-in Executor
/etc/inetd.conf:nrpe stream tcp nowait nagios /opt/nagios/sbin/nrpe nrpe -n -c /opt/nagios/etc/nrpe.cfg -i
[root@elba:/root]
# /opt/nagios/plugins/libexec/check_nrpe -n -H 127.0.0.1 -c check_disk
DISK CRITICAL - /export/oracle/arch1 is not accessible: Berechtigung verweigert
Ok, the failing check_disk reminds me that I still need to build in some sudo rule for non-readable,executable mount points by the nrpe user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 04:24 AM
09-01-2008 04:24 AM
Re: Would appreciate debugging tips for SD configure script
in case that the person installing the depot doesn't want to run through request with -x ask=true because they are happy with the defaults?
I mean I can't put it in advance into
$SW_CONTROL_DIRECTORY/response
could I?
I have't yet understood how to supply a preset response file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 04:24 AM
09-01-2008 04:24 AM
Re: Would appreciate debugging tips for SD configure script
netstat -an -f inet \
| awk -v p=${1:-5666} 'BEGIN{rc=1}; \
$1=="tcp"&&$NF=="LISTEN"&&a[split($4,a,".")]==p{rc=0;exit}; \
END{exit rc}'
}
You have too many "\". :-)
The first, you can remove the "\" and put the "|" at the end of the line.
You don't need any "\" inside the awk single quotes.
has_listen_socket() {
netstat -an -f inet |
awk -v p=${1:-5666} '
BEGIN {rc=1}
$1=="tcp" && $NF == "LISTEN" && a[split($4,a,".")] == p {
rc=0
exit
}
END {exit rc}'
}
You might want to add an echo before and after that one pipeline.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 04:28 AM
09-01-2008 04:28 AM
Re: Would appreciate debugging tips for SD configure script
You should use "set -u" to check for uninitialized shell variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2008 04:54 AM
09-01-2008 04:54 AM
Re: Would appreciate debugging tips for SD configure script
I am not terribly fond of awk and regard only as an inferior makeshift when one cannot expect to find perl.
That's why I never have invested too much bother on quoting voodoo in awk.
In perl we have the -MO=Deparse if we want to look behind the scenes.
Yes, I will take up the -u to aid in debugging.