Two versions of commands.json on Pi 4
-
I now have two different versions of commands.json on my Pi 4. Owner pi and owner root. The systemctl status triggercmdData says its using the file owned by root. Sadly I am unable to edit the file owned root as it gets restored.
I would like to use only one recommended place for managing commands.json. Pls. advise.
And to my surprise, how could it manage to create two separate versions.
-
@meetb, the commands.json file gets created in the home folder of the user who runs the agent.
On a Raspberry Pi I generally run the background service (daemon) as root because I'm dedicating the Pi to be a garage door opener, PiHole, or using it to wake up my PC. So I use /root/TRIGGERcmdData/commands.json and all of my commands have ground = background.
It's possible though that you might want to run X-Windows on your Pi and run the agent in foreground mode as pi, in which case you'd use the commands.json in pi's home folder.
Your commands.json file will be restored if the agent detects a problem in the json format, like a comma on the last entry, or if you forget to escape a quote or backslash. It restores the last valid commands.json file it had.