Ok.. for the ones who want to randomize the their VPN connection:
randomizeSabnzbdVPN.sh
#!/bin/sh
NOW=$(date +"%d-%m-%Y %H:%M")
container="sabnzbdvpn"
file=`ls /volume1/docker/sabnzbdvpn/ovpn/*.ovpn|sort -R|shuf -n 1`
rm -rf /volume1/docker/sabnzbdvpn/config/openvpn/*.ovpn
cp $file /volume1/docker/sabnzbdvpn/config/openvpn/
echo $NOW " - Cycling sabnzbdVPN to" $file >> /volume1/logging/vpn/vpn.log
docker restart --time 10 $container
- this will pick randomized .ovpn file form the directory /volume1/docker/sabnzbdvpn/ovpn/
- Have all you *.ovpn at /volume1/docker/sabnzbdvpn/ovpn/
- make sure the set your docker config to /volume1/docker/sabnzbdvpn/config/openvpn/
- Name your container at $container
Then do a Crontab like so:
0 05 * * * root if [ "`date +%H`" == "05" ]; then sleep ${RANDOM:1:2}m; fi; /volume1/docker/sabnzbdvpn/scripts/randomizeSabnzbdVPN.sh > /dev/null 2>&1
This will randomize also the execution of the script by added a random number of minutes starting from 05H00.
Make sure if you want to change the HOUR, change in both in the hour option of crontab AND in the script in the IF-statement to the same hour.
This will give you the possibility on a SYNOLOGY to run script immediately on all hour by hand without the random minutes (except ofcourse at 05:00)