How do I run an APT update right before shutdown? I want my Ubuntu to auto-update like Windows 😛

  • 1
    sudo something... i dont know... I stackoverflowd my entire life so far...
  • 0
    @cobolplz tried it... I made a systemd service, but it doesn’t trigger on shutdown, only works when I manually restart it
  • 5
    Any reason why not use simple: sudo apt-get upgrade && sudo shutdown now
  • 12
    Alias turnoff=‘sudo apt upgrade -y && sudo shutdown now’

    Sometimes it’s not that hard.
  • 0
    Kali Linux has this integrated, I guess it is included in some Gnome tools (it will even ask you: "Important software updates: Install & restart?").
  • 1
    -The computer is being shut down
    -My script runs
    -The computer proceeds with the shutdown process

    This is what I want to achieve
  • 2
    Okay, I had to tweak the systemd config, now it’s working 😁
  • 1
    Few posts make me want to downvote. Incidentally, I'm a Windows and Linux user that wants to dump Windows permanently but can't because of work.
  • 0
    Make a script that updates and then shutdown the computer?

    Not that hard
  • 0
    alias poweroff="sudo apt upgrade && /bin/poweroff"
  • 0
    @Krokoklemme that doesn’t do what I want, see my comment above, replying to someone who said exactly what you said

    @NeedsMoreDivs I use both, and Windows does updates better than Linux (actually, I like how Snap updates in the background). I don’t want to have to deal with updates.
  • 0
    @620hun not wanting to deal with them definitely does not make them better.

    But at least when there are updates for Linux, you can see what specifically is being updated and update as little or as much as you want at 1 time -- when you want to.
  • 0
    @NeedsMoreDivs it does for me. I couldn’t care less what’s being updated most of the time, I’m not doing anything critical on my laptop.
Add Comment