Running update manager from crontab [answered]

Post your update and upgrade related errors here
Forum rules
Before you post please read this

Running update manager from crontab [answered]

Postby abtygwyn on Fri Jun 13, 2014 9:08 am

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 abtygwyn on Mon Jun 16, 2014 5:03 pm, edited 1 time in total.
abtygwyn
Level 3
Level 3
 
Posts: 151
Joined: Mon Apr 25, 2011 4:33 am

Linux Mint is funded by ads and donations.
 

Re: Running update manager from crontab

Postby GeneBenson on Fri Jun 13, 2014 8:11 pm

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
GeneBenson
Level 3
Level 3
 
Posts: 181
Joined: Fri Sep 17, 2010 9:55 pm

Re: Running update manager from crontab

Postby abtygwyn on Mon Jun 16, 2014 9:57 am

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!
abtygwyn
Level 3
Level 3
 
Posts: 151
Joined: Mon Apr 25, 2011 4:33 am

Re: Running update manager from crontab

Postby karlchen on Mon Jun 16, 2014 10:28 am

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.
User avatar
karlchen
Level 11
Level 11
 
Posts: 3503
Joined: Sat Dec 31, 2011 7:21 am

Re: Running update manager from crontab

Postby Monsta on Mon Jun 16, 2014 10:33 am

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).
Monsta
Level 8
Level 8
 
Posts: 2447
Joined: Fri Aug 19, 2011 3:46 am

Re: Running update manager from crontab

Postby karlchen on Mon Jun 16, 2014 11:02 am

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
User avatar
karlchen
Level 11
Level 11
 
Posts: 3503
Joined: Sat Dec 31, 2011 7:21 am

Re: Running update manager from crontab

Postby abtygwyn on Mon Jun 16, 2014 5:03 pm

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.
abtygwyn
Level 3
Level 3
 
Posts: 151
Joined: Mon Apr 25, 2011 4:33 am

Re: Running update manager from crontab

Postby turtlebay777 on Tue Jun 17, 2014 4:30 am

karlchen wrote:
The core of this script might be 2 simple commands like
Code: Select all
apt-get dist-upgrade
Note:
[list][*]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
For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.
User avatar
turtlebay777
Level 4
Level 4
 
Posts: 347
Joined: Tue Apr 15, 2014 4:56 pm

Linux Mint is funded by ads and donations.
 

Return to Update/Upgrade Issues

Who is online

Users browsing this forum: No registered users and 10 guests