0

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

Deepak Rai
  • 2,163
  • 3
  • 21
  • 36
CXR
  • 33
  • 4
  • 1
    create one script, which starts your script, and put this script in the crontab. Then in your crontab, you can focus on when to run the scripts, and you can test test script easily by running it manually. – Luuk Jan 30 '21 at 15:27

1 Answers1

0

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

ELB
  • 16