Commit 73a49e64 authored by Vitalii Panchokha's avatar Vitalii Panchokha
Browse files

Update ISP

parent 92727749
......@@ -34,27 +34,27 @@ if !(/usr/local/mgr5/sbin/mgrctl -m ispmgr license.info &> /dev/null); then
check=0
fi
license_date=^$(/usr/local/mgr5/sbin/mgrctl -m ispmgr license.info | grep licdate | grep -Eo '.{10}$')
if [ -n "^$license_date" ]; then
date_difference=^$(((^$(date +%s --date ^$license_date)-^$(date +%s --date ^$(date +"%y-%m-%d")))/(3600*24)))
license_date=\$(/usr/local/mgr5/sbin/mgrctl -m ispmgr license.info | grep licdate | grep -Eo '.{10}$')
if [ -n "\$license_date" ]; then
date_difference=\$(((\$(date +%s --date \$license_date)-\$(date +%s --date \$(date +"%y-%m-%d")))/(3600*24)))
else
date_difference=11
fi
if [ ^$check -eq 1 ]; then
if [ ^$date_difference -gt 10 ] && [ -n "^$license_date" ]; then
echo "OK - License will expire on ^$(date +%x --date ^$license_date)."
if [ \$check -eq 1 ]; then
if [ \$date_difference -gt 10 ] && [ -n "\$license_date" ]; then
echo "OK - License will expire on \$(date +%x --date \$license_date)."
exit 0
elif [ ^$date_difference -gt 10 ] && [ ! -n "^$license_date" ]; then
elif [ \$date_difference -gt 10 ] && [ ! -n "\$license_date" ]; then
echo "OK - License is unlimited."
exit 0
elif [ ^$date_difference -gt 5 ] && [ ^$date_difference -le 10 ]; then
elif [ \$date_difference -gt 5 ] && [ \$date_difference -le 10 ]; then
echo "WARNING - License will expire in ^$date_difference days."
exit 1
elif [ ^$date_difference -gt 0 ] && [ ^$date_difference -le 5 ]; then
echo "CRITICAL - License will expire in ^$date_difference days."
elif [ \$date_difference -gt 0 ] && [ \$date_difference -le 5 ]; then
echo "CRITICAL - License will expire in \$date_difference days."
exit 2
elif [ ^$date_difference -le 0 ]; then
elif [ \$date_difference -le 0 ]; then
echo "CRITICAL - License has expired."
exit 2
else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment