So I've been having some issues with my drives encrypting themselves lately (had asked about that in this thread), and I'm thinking the solution will be eventually to just remove my LUKS disk encryption, and simply have encrypted containers for particular things I'd like to secure.
That said, I don't yet have a way to back up everything from these drives so I can format them, in the meantime I just want to run a bash script cron job that attempts to decrypt each of my encrypted drives with a hardcoded password, and if any do end up being decrypted (meaning they had become randomly re-encrypted again), it also restarts the mergerfs pool afterwards, since things don't seem to work until I do.
I only describe all of the above before people yell at me that including the password and automating this script takes away all the security benefit of disk encryption in the first place.
Anyway, I have the first part working and my bash script unlocks my drives. Now for the next part, how do I restart my mergerfs pool from a bash script?
While we're at it, is there a way to stop and start each Portainer stack too? I know how to do it per-container, but it'd be cool to start the entire docker-compose stack.