Skip to content

Commit

Permalink
added list_plugins.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Apr 28, 2020
1 parent a539aae commit 9bf3ba1
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions nagios-plugins-python/list_plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2020-04-28 17:46:31 +0100 (Tue, 28 Apr 2020)
#
# https://github.com/harisekhon/Dockerfiles
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#

set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x

nagios_plugins="/github/nagios-plugins"

if [ -d "$HOME/github/nagios-plugins" ]; then
nagios_plugins="$HOME/github/nagios-plugins"
fi

submodules="$(cd "$nagios_plugins"; git submodule status | awk '{print $2}')"

# shellcheck disable=SC2046
# trying to do -exec basename {} \; results in only the jython files being printed
find "$nagios_plugins" \
-maxdepth 2 \
-type f \
-iname '[A-Za-z]*.sh' -o \
-iname '[A-Za-z]*.pl' -o \
-iname '[A-Za-z]*.py' |
grep -iv -e makefile -e lib_ -e /tests/ -e /setup/ \
$(for submodule in $submodules; do echo -n "-e $submodule "; done) |
xargs -n1 basename |
sort

0 comments on commit 9bf3ba1

Please sign in to comment.