main脚本
#!/bin/bash
LOGPATH="/mnt/logging.log"
logging(){
msg=$(date +%Y-%m-%d\ %H:%M:%S)"|"$1
echo $msg >> $LOGPATH
}
logging "---------------- hello 01 -----------------------"
#RULE_PATH="/mnt/check_package"
#if [[ -d $RULE_PATH ]]; then
count=`python get_count.py`
echo $count
if [ $count -ge 1 ]; then
logging "---------------- count >= 1 -----------------------"
else
logging "---------------- [ERROR]: count < 1 -----------------"
fi
get_count.py
a = 1
print a
logging.log
2019-01-11 15:27:33|---------------- hello 01 -----------------------
2019-01-11 15:27:33|---------------- count >= 1 -----------------------
2019-01-11 15:27:46|---------------- hello 01 -----------------------
2019-01-11 15:27:46|---------------- count >= 1 -----------------------