#!/bin/bash case "$1" in expire) a=`/usr/sbin/vzlicview | grep expiration | tail -n1 | cut -d"\"" -f2` if [ "${a}" != "unlimited" ]; then if [ "$((($(date -d "${a}" +"%s")-$(date +"%s"))/60/60/24))" -le "7" ]; then echo "1" else echo "0" fi else echo "0" fi ;; ve_free) VELIC=$(/usr/sbin/vzlicview | grep ct_total | cut -d'=' -f2 | awk '{print $1}') VEINUSE=$(/usr/sbin/vzlicview | grep ct_total | cut -d'=' -f2 | awk '{print $2}' | sed 's/[\(\)]//g') VEFREE=$(($VELIC-$VEINUSE)) echo "${VEFREE}" ;; *) echo "Following Paramters are allowed:" echo -e "\texpire - to check if the Licence about to expire" echo -e "\tve_free - to check if the Licence have enough free VEs" ;; esac exit 0