How to detect failure

I am working on a saas app based on REST api built with golang and hosted on ec2 instance. On this product I have cron jobs fro different purposes like sending reminders to customers and mark complete the appointments. I have used gin-gonic framework. Cron jobs are working fine most of the times but sometime it dont run. I am not sure how can I detect the issue. Initially I thought that server has been stopped but when I checked I found that its still running on 8080 port but cron jobs are not running.

Is there any way to track the failure and resolve them. I am also open for cron job implementation suggestion as I am pretty sure that I have not done it well. following is my implementation

package main
import (
“bkapi/cron”
)
func main(){
cron.RunCron()
NewRouter()
}

Following is my cron package

package cron
import (
“gopkg.in/robfig/cron.v2”
“bkapi/utils”
“bkapi/config”
)
func RunCron() {
c := cron.New()
c.AddFunc(“@every 0h15m0s”, SendOneDayReminders)
c.Start()
}
func SendOneDayReminders(){
utils.ExecuteCommand("sh "+config.GetBasePath()+“sh/one_day_booking_reminders.sh”)
}

Each cron job is executing a sh file which has urls for all merchants like

curl “127.0.0.1:8080/ren/complete-booking”

which runs and api locally on ec2 instance

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.