0

Origanally I have posted this question on stackoverflow, due to the fact it is the wrong forum. I'm asking the question again here with some extra information I have gathered.

I'm looking into creating a script in bash for automating my update-u^grade process for all my virtual machiens as a homelabber.

I'm a developer but currently not have that good knowledge of bash:

My current script is pretty simple:

#!/bin/sh

apt update -y apt upgrade -y apt autoremove -y

After some answers on the stackoverflow and some research on this forum I missed the DEBIAN_FRONTEND=noninteractive part So i tested with this command: sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y but still witouth good results.

The problem i'm facing is that all my virtual machines have the sh config file edited with a /etc/issue.net included since this is a standard security practice founded on every information I could gather. Due to the fact that this file has been edited, while upgradeing the ssh-server package it asks what I want to do? Default it will take the local edited version but it requires the user to PRESS ENTER When trying the command above I still had to PRESS ENTER, however after the upgrade was done I discovered in the terminal NEEDRESTART DEBIAN_FRONTEND=noninteractive service.

So first: Is it possible after env variable change it need a restart to take affect? Due to the fact that the ssh package does not always have an upgrade available is there something I can do to test this?

And/or as last question Does the env variable not change the effect for the user input? I haven't tested my script on cron tab to see if it's is working or not due to the fact again that there is not always an upgrade available.

terminal

muru
  • 197,895
  • 55
  • 485
  • 740

0 Answers0