SOLVED cron job to restart openvpn client service - possible?

Sasquatch

Explorer
Joined
Nov 11, 2017
Messages
87
Hi I'm running replication over VPN to remote machine.
problem is if my connection drops for longer than 10 minutes, or during replication, OpenVpn service stops.
is there a way to restart the service?
--keepalive option is set and working great to keep connection alive when idle(no replication) but if remote truenas goes offline the service stops and needs to be restarted via GUI

same was happening in TrueNAS-13.0-U3.1 and now in TrueNAS-13.0-U5.2
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
It should be as simple as an API call to service.restart

midclt call service.restart servicename

See if you can get that to work at the CLI first and once you have it, then use it in a cron task.
 

Sasquatch

Explorer
Joined
Nov 11, 2017
Messages
87
It should be as simple as an API call to service.restart

midclt call service.restart servicename

See if you can get that to work at the CLI first and once you have it, then use it in a cron task.
we posted at the same time, lol, finding the service name was trickiest part,
Code:
midclt call service.query

lists all of them
 
Top