Jail running qBittorrent & Openvpn with firewall crashing regularly, cron job issues

ShameSpear

Dabbler
Joined
Nov 30, 2022
Messages
14
So every few days I'll log on to my qbittorrent and find that there's no traffic going thru at all. I eventually figured out that if I went through and stopped services one at a time then restarted them, traffic would start flowing again. IE:
Code:
service qbittorrent stop
service openvpn stop
service ipfw stop
service qbittorrent start
service openvpn start
service ipfw start

Obviously, this is bothersome to do and I don't check every day so I thought I should set up a cron job to just shut down the services and restart them every night.

So I set up a cron job to run the commands every day at midnight using the below commands:
Code:
jexec 4 service qbittorrent stop; jexec 4 service openvpn stop; jexec 4 service ipfw stop; jexec 4 service ipfw start; jexec 4 service openvpn start; jexec 4 service qbittorrent start;


This will restart all the services, but for whatever reason the traffic still won't resume after the cron job. If I go into the TrueNAS shell and run the above commands one after another, then the traffic will resume. I'm wondering if it's a speed issue? Like the cron job issues everything so fast that the processes don't have enough time to refresh themselves?

If anyone has any insights, please let me know. Otherwise I'll try separating the commands into their own cron job and have them run with a minute gap in between them, see if that kicks it into gear.
 

ShameSpear

Dabbler
Joined
Nov 30, 2022
Messages
14
If anyone ends up here - I couldn't get it to work any other way than splitting up cron jobs and putting a minute in between them. But doing that has worked gang busters. It's not clean, but it gets the job done.
 

Attachments

  • 2023-11-28 09_41_46-TrueNAS - 192.168.68.4 — Mozilla Firefox.png
    2023-11-28 09_41_46-TrueNAS - 192.168.68.4 — Mozilla Firefox.png
    28.2 KB · Views: 40
Joined
Oct 22, 2019
Messages
3,641
That seems overkill. I would try to figure out what is causing the constant drops.

Perhaps your OpenVPN connection conks out?

Relying on using a Cron Task from the host, to regularly stop-start services inside a jail, just seems... yucky.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Couple things. You should be using the jail name for your cron task as the jail ID can change. Also if you want to string together commands use the && argument to run them in succession. This is a really poor way to do this though. A better way would be to write a script and run the script via a cron task.
 

ShameSpear

Dabbler
Joined
Nov 30, 2022
Messages
14
Took me some time guys but I figured out how to run the script in the jail and have the cron job execute it. If any other noobs show up confused, here you go:

1) nano /root/restart.sh
2) paste in commands
service qbittorrent stop service openvpn stop service ipfw stop sleep 3 service qbittorrent start service openvpn start service ipfw start
3) chmod +x /root/restart.sh
4) ./restart.sh (to test)
5) go to cron jobs and make a new one that targets your jail and runs the script, IE "jexec 3 /root/restart.sh"

@Jailer, I never found out how to target a jail via name versus it's jail ID. If you have any more guidance, simply putting "jexec Qbit_Movies /root/restart.sh" didn't work.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
@Jailer, I never found out how to target a jail via name versus it's jail ID. If you have any more guidance, simply putting "jexec Qbit_Movies /root/restart.sh" didn't work.
Try iocage exec Qbit_Movies csh /restart.sh
 

ShameSpear

Dabbler
Joined
Nov 30, 2022
Messages
14
Had to point it at /root/restart.sh still, but otherwise that worked like a charm! Thanks Jailer
 
Top