mercredi 25 septembre 2019

Cron Not working for bash script but working on terminal

code :

#!/bin/bash
redis_metrics=$(redis-cli ping)

if [ $redis_metrics == PONG ]
then
        redis_metrics=100

else
        redis_metrics=0

fi


echo $redis_metrics

aws cloudwatch put-metric-data --metric-name redis_status --dimensions Instance=i-0bbebasfe123 --namespace "Custom" --value ${redis_metrics}

echo is also printing , but in cron it is not working

tried this in crontab -e

          • /home/elmaro/redis_st.sh
          • bash /home/elmaro/redis_st.sh
          • /bin/bash /home/elmaro/redis_st.sh

Aucun commentaire:

Enregistrer un commentaire