Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create check_reboot_req.bash #414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

snathan9
Copy link

check_reboot_req.bash alerts if systems needs rebooting for Debian/Ubuntu systems

check_reboot_req.bash alerts if systems needs rebooting for Debian/Ubuntu systems
echo "System OK"
exitstatus=$STATE_OK
fi
exit $exitstatus
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

if [ -f "${RFILENAME}" ]; then
CDATE=$(date +%s)
FDATE=`stat -c %Y -- "${RFILENAME}"`
DDIFF=$(($CDATE-$FDATE))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$/${} is unnecessary on arithmetic variables.

#
if [ -f "${RFILENAME}" ]; then
CDATE=$(date +%s)
FDATE=`stat -c %Y -- "${RFILENAME}"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use $(...) notation instead of legacy backticked ....

if [ -z $warn ]; then
declare -i warn=0
fi
if [ -z $crit ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

done

# Check begins here
if [ -z $warn ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

case "$1" in
--help)
print_help
exit $STATE_OK
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

}

print_help() {
print_revision $PROGNAME $REVISION
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION="1.0"

. $PROGPATH/utils.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

TOUCH="/bin/touch"

PROGNAME=`/usr/bin/basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

CHMOD="/bin/chmod"
TOUCH="/bin/touch"

PROGNAME=`/usr/bin/basename $0`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quote to prevent globbing and word splitting.

Copy link

sonarcloud bot commented Nov 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant