Add Install/Remove Command Line Switches
"Marko Myllynen" <[email protected]> Mon, 20 Feb 2017 13:13:14 +0200
| Newsgroups | gmane.comp.sysutils.pcp |
|---|---|
| Organization | Red Hat |
| Message-ID | <[email protected]> |
Hi,
What do you think about this patch? Every now and then someone asks for
command line switches to select the proper mode (*) for PMDAs, let's
add them so that people won't need spend time discovering "echo c |
./Install" :) Also add standard --help/--version switches while at it.
*) While the patch allows defining the proper mode for a PMDA, reading
the man pages, the Programmer's Guide, and the code in pmdaproc.sh
leaves me still unclear what/how this PMDA monitor mode is supposed to
be / work. PCPIntro(1) and others describe monitors being tools like
pmlogger, pmrep, pmval, etc. but don't explain how a PMDA could work in
such mode. Clarifications on man pages would be much appreciated.
---
src/pmcd/pmdaproc.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 46 insertions(+), 4 deletions(-)
diff --git a/src/pmcd/pmdaproc.sh b/src/pmcd/pmdaproc.sh
index d00ea02..586d9e0 100644
--- a/src/pmcd/pmdaproc.sh
+++ b/src/pmcd/pmdaproc.sh
@@ -3,7 +3,7 @@
#
# Copyright (c) 1995-2001,2003 Silicon Graphics, Inc. All Rights Reserved.
# Portions Copyright (c) 2008 Aconex. All Rights Reserved.
-# Portions Copyright (c) 2013-2016 Red Hat.
+# Portions Copyright (c) 2013-2017 Red Hat.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -644,6 +644,18 @@ _choose_configfile()
#
__choose_mode()
{
+ # Non-interactive
+ if [ -n "$pmda_mode" ]; then
+ if [ "$pmda_mode" = "m" ]; then
+ do_pmda=false
+ return
+ else
+ do_pmda=true
+ return
+ fi
+ fi
+
+ # Interactive
__def=m
$do_pmda && __def=b
echo \
@@ -1535,6 +1547,8 @@ PMNSROOT=`basename $NAMESPACE`
ECHONL="echo -n"
# Install control variables
+# PMDA mode from command line, b|c|m
+pmda_mode=
# Can install as DSO?
dso_opt=false
# Can install as perl script?
@@ -1589,10 +1603,38 @@ while [ $# -gt 0 ]
do
case $1
in
+ -h|--help) # print help and exit
+ if [ "$prog" = "Install" ]
+ then
+ echo "Usage: $prog [-bcehmNQVv] [-n namespace] [-R rootdir]"
+ else
+ echo "Usage: $prog [-ehNQVv] [-n namespace]"
+ fi
+ exit
+ ;;
+
+ -v|--version) # print version and exit
+ $PCP_ECHO_PROG $PCP_ECHO_N "PMDA $prog part of ""$PCP_ECHO_C"
+ pcp --version | sed -e 's,pcp,PCP,'
+ exit
+ ;;
+
+ -b|--both) # installation mode "both"
+ pmda_mode=b
+ ;;
+
+ -c|--collector) # installation mode "collector"
+ pmda_mode=c
+ ;;
+
-e) # echo user input
__echo=true
;;
+ -m|--monitor) # installation mode "monitor"
+ pmda_mode=m
+ ;;
+
-N) # name space only
do_pmda=false
;;
@@ -1618,7 +1660,7 @@ do
-R) # $ROOT
if [ "$prog" = "Remove" ]
then
- echo "Usage: $prog [-eNQV] [-n namespace]"
+ echo "Usage: $prog [-ehNQVv] [-n namespace]"
status=1
exit
fi
@@ -1639,9 +1681,9 @@ do
*)
if [ "$prog" = "Install" ]
then
- echo "Usage: $prog [-eNQV] [-n namespace] [-R rootdir]"
+ echo "Usage: $prog [-bcehmNQVv] [-n namespace] [-R rootdir]"
else
- echo "Usage: $prog [-eNQV] [-n namespace]"
+ echo "Usage: $prog [-ehNQVv] [-n namespace]"
fi
status=1
exit
Thanks,
--
Marko Myllynen
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:
You receive all messages sent to this group.
View/Reply Online (#15229): https://groups.io/g/pcp/message/15229
View All Messages In Topic (1): https://groups.io/g/pcp/topic/4404906
Mute This Topic: https://groups.io/mt/4404906?uid=174580
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
[email protected]
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub?uid=174580
Group Home: https://groups.io/g/pcp
Contact Group Owner: [email protected]
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354243/563757577/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-