-
Notifications
You must be signed in to change notification settings - Fork 506
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
base: master
Are you sure you want to change the base?
Conversation
check_reboot_req.bash alerts if systems needs rebooting for Debian/Ubuntu systems
echo "System OK" | ||
exitstatus=$STATE_OK | ||
fi | ||
exit $exitstatus |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# | ||
if [ -f "${RFILENAME}" ]; then | ||
CDATE=$(date +%s) | ||
FDATE=`stat -c %Y -- "${RFILENAME}"` |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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,[\\/][^\\/][^\\/]*$,,'` |
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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.
Kudos, SonarCloud Quality Gate passed! |
check_reboot_req.bash alerts if systems needs rebooting for Debian/Ubuntu systems