Page 1 of 1

G_INTERACTIVE=0 Will turn off user input for any dietpi command

Posted: Fri Sep 04, 2020 5:14 pm
by kondrav
Was looking to automate dietpi-backup with cron and ensure that no user interaction is required. The solution I found said to set the G_USER_INPUT=0 but I guess that has changed since a couple of years ago. After digging though the code, the way to do it is to set the G_INTERACTIVE=0 before any command

for example

Code: Select all

G_INTERACTIVE=0 /boot/dietpi/dietpi-backup 1
hope this saves someones time 8)

Re: G_INTERACTIVE=0 Will turn off user input for any dietpi command

Posted: Fri Sep 04, 2020 8:08 pm
by MichaIng
Jep G_INTERACTIVE is the direct replacement for G_USER_INPUT for a while. Within cron jobs it should though not be required as it's set to 0 automatically when non input terminal is found (STDIN is no terminal => [ -t 0 ] returns false). Same for systemd services. But it doesn't hurt to set it. If so export it to assure it's set for all sub scripts as well.