【发布时间】:2019-04-06 23:18:43
【问题描述】:
当我执行下面的脚本时,它运行良好,并且我在电子邮件中收到了结果。但是当我将其作为 cron 作业运行时,它会发送 0 个代理。
我有一个下面的脚本 t(countagentid.sh)..
if [ -e /home/countagentid.csv ]
then
rm -rf /home/countagentid.csv
fi
cqlsh -f countagentid.cql `hostname -I` -u cassandra -p password -- (countagentid.cql has cql statment which will generate the output of cql query and save in csv format)
OUTPUT="$(cat /home/countagentid.csv |sort|uniq|wc -l)" --I sort & get the distinct values of the csv and assign it to $OUTPUT variable
clustername=`cat /etc/cassandra/conf/cassandra.yaml |grep cluster_name |cut -f2 -d :`
mailalert(){
/sbin/sendmail -F Cassandra -it <<END_MESSAGE
To: test@gmail.com
Subject: Number of agents in Cassandra $clustername
$OUTPUT Number of agents.
END_MESSAGE
}
mailalert
【问题讨论】:
标签: linux cron centos7 datastax cassandra-3.0