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

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
kondrav
Posts: 1
Joined: Fri Sep 04, 2020 5:02 pm

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

Post 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)
User avatar
MichaIng
Site Admin
Posts: 2331
Joined: Sat Nov 18, 2017 6:21 pm

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

Post 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.
Post Reply