Skip to content

Detect location of [ sudo lsof awk wc ]  #1

@box293

Description

@box293

Might be good to detect the location of the files:

sudo
lsof
awk
wc

Using CentOS 6.x, the first time I tried to run it I got:

!!! command failure !!! Username wrong

I installed lsof and changed the script to:

LSOF=/usr/sbin/lsof

Then when I tried to run it I got the errors:

./nagios_check_open_files.sh: line 36: /bin/sudo: No such file or directory
./nagios_check_open_files.sh: line 38: /bin/wc: No such file or directory
./nagios_check_open_files.sh: line 38: /bin/sudo: No such file or directory
(standard_in) 1: syntax error
./nagios_check_open_files.sh: line 42: [: -lt: unary operator expected
./nagios_check_open_files.sh: line 46: [: -ge: unary operator expected
./nagios_check_open_files.sh: line 49: [: -ge: unary operator expected

Once I updated these:

SUDO=/usr/bin/sudo
WC=/usr/bin/wc

It ran just fine:

./nagios_check_open_files.sh nagios

FILES OK - 18 % with 762 files open|files=762;;;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions