0

I'm new to the world of linux and scripting, The OS is Amazon Linux 2 (EC2 instance).

The instance have a Strongswan Site-to-Site VPN connectivity to endpoint IP address 1.1.1.1

The problem is that it disconnects randomly and I have to run the command "sudo strongswan restart" everytime to reestablish the connection.

What I would like to learn right now is a script that continuously checks the connectivity to 1.1.1.1 and runs the "sudo strongswan restart" once disconnected and how to set a cron job for it.

Right now the only thing I can manage for cron is to run this job every 1 hour which works.

0 * * * * sudo strongswan restart

I need help for the script that check for ping timeout and run the VPN restart command

0 Answers0