Run script if container restart

Hello! Need some help,please.

I have this compose-file:

version: “3"
services:
db:
image: mysql
container_name: mysql
volumes:
- /mysql:/var/lib/mysql
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- MYSQL_ROOT_PASSWORD=password_plus_aaa
ports:
- “3306:3306"
restart: always
command: mysqld --sql_mode=””

If mysql crashs, the container restarts, no problem (“restart: always” is working fine).

I want to be notified that this container has auto restarted.

I want to receive an email ou run a bash script when docker restarts a crashed container.

I don´t want to be notified if I run “docker-compose up”. I just want to known when a problem occurs.

Any ideias?
Thanks!
Fabricio