Modifying the Restart Policy of a Container
Let us get back to our previous example and go to the cloned checkout of our device:
cd home_rpi64_latest
ls
In there, we will find the container homeassistant
that we just installed with pvr
. Inside the homeassistant
container, we will find the src.json and the run.json files. The first one will be used by pvr
, while the second one will be parsed by Pantavisor
itself. Let us first take a look at the configured restart policy in the run.json first:
$ jq .restart_policy homeassistant/run.json
"container"
As we can see, pvr app add
has set that restart_policy from the one we last set with the --restart-policy
option. If we want to change that without having to reinstall the container, we have to do it in the src.json, as run.json is not meant to be directly edited:
$ jq .args.PV_RESTART_POLICY homeassistant/src.json
"container"
And manually edit it to look like this:
$ jq .args.PV_RESTART_POLICY homeassistant/src.json
"system"
Now, if we use the pvr app install
command:
pvr app install homeassistant
The pvr
tool will take the value from the src.json file and apply it at the run.json:
$ jq .restart_policy homeassistant/run.json
"system"
Now, again, you can commit and post the changes to start using them in your device:
pvr add .
pvr commit
pvr post -m "change homeassistant restart policy to system"