1

I am trying to monitor my server through a script which is run by cron in HP-UX environment. However, an if-else condition is not working correctly when run by cron. For example, if certain condition appears, the script should send mail. But when run by cron, the program is not sending mail. Also, when I am trying to run the script independently, the mail is getting sent. Is this a known issue in HP-UX?

  • 2
    What does your cronjob look like, and what does the script look like? – u1686_grawity Jun 22 '19 at 10:26
  • if [ $cnt -gt 0 ] then cp /dev/null /Server/folder/amol.txt echo "There are total of $cnt STUCK threads on 83 server. Please take necessary action" >> /Server/folder/amol.txt echo "Timestamp:"+$dat>>/Server/folder/amol.txt (cat /Server/folder/amol.txt) | /bin/mailx -s "FEASIBILITY SERVER THREAD STUCK NOTIFICATION!!(10.113.244.83)" 'abc@abc.com' cp /dev/null /Server/folder/amol.txt echo "Timestamp:"+$dat>>/Server/folder/amol.txt echo "Nothing is STUCK\n" >> /Server/folder/amol.txt fi – Amol.Vaibhav Jun 25 '19 at 09:55
  • above is if-else part of my script – Amol.Vaibhav Jun 25 '19 at 09:55
  • 0 * * * * sh /Server/folder/health.sh – Amol.Vaibhav Jun 25 '19 at 09:56
  • and above is how my cron is schduled – Amol.Vaibhav Jun 25 '19 at 09:56

0 Answers0