Running update manager from crontab [answered]

Archived topics about LMDE 1 and LMDE 2
Locked
abtygwyn

Running update manager from crontab [answered]

Post by abtygwyn »

I'm not sure if this is a totally good idea but since I have limited download bandwidth during the day, I thought it would be sensible to try and do my updating during the night when I am essentially unlimited. Short of running things manually and being up at 1:00am :-) I thought it would be handy to use crontab to schedule the update however, I can't find anything specifically covering this, apart from one to comments which might suggest it isn't possible anyway.

Questions are:
1. Is it possible
2. If so, how
3. Is it wise and what are the downsides

Thanks
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
GeneBenson
Level 4
Level 4
Posts: 357
Joined: Fri Sep 17, 2010 9:55 pm

Re: Running update manager from crontab

Post by GeneBenson »

Hi abtygwyn,

I believe what you are looking for is "unattended-upgrades". Fire up your favorite search engine and have a look at: debian unattended-upgrades.

Hope this helps. :D
abtygwyn

Re: Running update manager from crontab

Post by abtygwyn »

GeneBenson wrote:Hi abtygwyn,

I believe what you are looking for is "unattended-upgrades". Fire up your favorite search engine and have a look at: debian unattended-upgrades.

Hope this helps. :D
Thanks but I don't think unattended upgrades is really what I'm looking for.
I simply want a way of downloaded the files to be installed during a specific time, ie between the hours of 1:00am and 8:00am.
If I could run a command in crontab to do this, that would be ideal, it's just I don't know and can't seem to find the command line to get update manager to run. If anybody could paste that in as a reply, that would be more than helpful!
User avatar
karlchen
Level 23
Level 23
Posts: 18187
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Running update manager from crontab

Post by karlchen »

Hello, abtygwyn.

From your own words
I simply want a way of downloaded the files to be installed during a specific time, ie between the hours of 1:00am and 8:00am.
I conclude that GeneBenson is perfectly right: what you are looking for are unattended-upgrades.
Unattended upgrades means that the system checks which software updates are available, downloads them and applies the updates, all this without any user intervention.
mintUpdate (the update manager) is an interactive GUI programme which will do virtually nothing without the user clicking OK, except checking which software updates are available.
So launching this GUI programme by cron will be of little use. It would not start downloading anything before you give it a GO.
This in turn defeats your idea that your cronjob should do the the whole job some time between 1:00 and 08:00 a.m.

In case you do not like the term "unattended upgrade" and in case you do not like fiddling around with the apt-get configuration in order to allow unattended upgrades, you might create a script which will be launched by cron every night at 01:00 am. The core of this script might be 2 simple commands like

Code: Select all

apt-get update
apt-get dist-upgrade
Note:
  • Both commands require root permissions. So the whole cronjob must be run by root.
  • Error checking and logging should be added to such a script, else strange things might have happened without you ever noticing
  • "apt-get dist-upgrade" will not honour any mintUpdate safety levels. I.e. if you have configure mintUpdate to display, download and install updates of safety levels 1, 2 and 3, apt-get will not care and install all available updates.
It might be possible to create a script which only downloads the available updates. But I have not checked whether this really works this way. And your would have to launch the actual upgrade manually afterwards.

Code: Select all

apt-get update
apt-get --download-only dist-upgrade
Kind regards,
Karl
Last edited by karlchen on Mon Jun 16, 2014 11:04 am, edited 2 times in total.
Reason: replaced "upgrade" by "dis-upgrade", because monsta explained that "upgrade" were not recommended on LMDE, see post below.
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 762 days now.
Lifeline
Monsta
Level 10
Level 10
Posts: 3071
Joined: Fri Aug 19, 2011 3:46 am

Re: Running update manager from crontab

Post by Monsta »

karlchen wrote:

Code: Select all

apt-get update
apt-get upgrade
Just a side note: apt-get upgrade is not recommended in LMDE, apt-get dist-upgrade must be used instead to achieve the same result as with LMDE's version of mintUpdate (mintupdate-debian, which is different from the main edition's mintUpdate).
User avatar
karlchen
Level 23
Level 23
Posts: 18187
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Running update manager from crontab

Post by karlchen »

Arghh, sorry, monsta.

It happened again. Looking at the view of threads which I had been involved in I have overlooked the 4 letter word LMDE. :oops:
I'll correct my previous post accordingly.

Cheers,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 762 days now.
Lifeline
abtygwyn

Re: Running update manager from crontab

Post by abtygwyn »

karlchen wrote:Arghh, sorry, monsta.

It happened again. Looking at the view of threads which I had been involved in I have overlooked the 4 letter word LMDE. :oops:
I'll correct my previous post accordingly.

Cheers,
Karl
Thanks all.

I think I get the drift that it's a customization too far. I'll either just eat into my normal download allowance or do the download when I'm in a wifi cafe :-)

Thanks for the feedback though. At least I can stop trying to figure out something which isn't really feasible.
Last edited by abtygwyn on Tue Jun 17, 2014 5:51 am, edited 1 time in total.
turtlebay777

Re: Running update manager from crontab

Post by turtlebay777 »

karlchen wrote:
The core of this script might be 2 simple commands like

Code: Select all

apt-get dist-upgrade
Note:
  • Both commands require root permissions.
    Kind regards,
    Karl
You certainly know your stuff Karl, your advise to someone else has helped me with a slightly different problem

The update 'shield' indicated I had some updates but clicking on it, entering password, etc. resulted in the update manager crashing with nothing updated.

I used terminal and pasted :

Code: Select all

sudo apt-get update
and

Code: Select all

sudo apt-get dist-upgrade
and it updated the 8 reluctant updates.

Thanks from me too!

Pete
Locked

Return to “LMDE Archive”