Skip to content

Create check_reboot_req.bash#414

Open
snathan9 wants to merge 1 commit intoHariSekhon:masterfrom
snathan9:patch-1
Open

Create check_reboot_req.bash#414
snathan9 wants to merge 1 commit intoHariSekhon:masterfrom
snathan9:patch-1

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.

@sonarqubecloud
Copy link

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