Hi all,
I’m trying to write a bash function to do dist- upgrades. So instead of typing
apt-get update
apt-get dist-upgrade -f -m -y
apt-get autoremove --purge -y
apt-get clean
apt-get update
I would just have to type a function name “update-everything()” which would look like this:
function upgrade_me{
apt-get update && apt-get dist-upgrade -f -m -y && apt-get autoremove --purge -y && apt-get clean && apt-get update
if{ needsrestart = 1
prompt= okay } fi
}
It was suggested I use the expect command to get the prompts handled but the needsrestart outputs two things, either OK or Close so now I’m unsure if I could do something like expect OK ||Close
in my function (the man page isn’t very clear on that).
Thanks for any advice, if I can get this to work I can make it a Cron Job that runs everyday at 01:00 or something. My apticron runs everyday at 00:05 so I’d want to make sure they both don’t run at the same time.