Search code examples
mysqllinuxbashgolang-migrate

How to send emails via cron job usng Golang MySQL?


Hope you all doing well. how can i using cron job and cron tab(by golang connection my sql) or anothor way using bash script excute (file golang) how can i do that.

in crontab -e : set the code

31 17 * * * cd /home/shanaz/Desktop/GO export/home/shanaz/Desktop/GO:bash sql.sh

when sql.sh code here

go run sqll.go


Solution

  • Hope you're doing well too.

    If you want to use crontab, you might want to make your shell script global by making a command calling it in your bash profile file.

    If you prefer however, you can call your go script once and it would make the job alone with a goroutine processing your SQL actions when time.Now() has the values you want :

    https://tour.golang.org/concurrency/6