geth --exec starts an interpreter. It allows to run geth console commands.
Currently, I have to manually mine every time and stop mining.
geth --jspath "/root/files/js" --exec 'eth.mining;loadScript("mine_pending_transactions.js");eth.mining;' --datadir=/root/.ethereum/devchain attach
However, I don't want to mine this manually. In order to automate this, I want to load the script and mine it, as if it's a something like background command that runs in the geth console interpreter.
Is there a way to do that? Even in case of non-interactive console? Couldn't find anything on official Ethereum documentation.