[SOLVED] mintupdate-tool scripts / cron

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
User avatar
smurphos
Level 14
Level 14
Posts: 5243
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

[SOLVED] mintupdate-tool scripts / cron

Post by smurphos »

Hi,

Anybody successfully built any bash scripts or cronjobs with mintupdate-tool yet?

I'm thinking of trying to automate level 1-3 updates for my media server laptop with an email alert of installed updates and any available level 4 updates to review.

It's on XFCE 18.2 with sSMPT installed as simple mailer linked to Gmail.

Any pointers welcome.
Last edited by smurphos on Sun Aug 06, 2017 2:54 am, edited 1 time in total.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
smurphos
Level 14
Level 14
Posts: 5243
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: mintupdate-tool scripts / cron

Post by smurphos »

Pretty simple...

sudo crontab -e and then add

Code: Select all

MAILTO="me@myisp.com"
0 6 * * * mintupdate-tool -r list && mintupdate-tool -l123 upgrade
Refresh list of upgrades, list them and then install all level 1 to 3 at 6am every morning. Send an email with the output.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
smurphos
Level 14
Level 14
Posts: 5243
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: mintupdate-tool scripts / cron

Post by smurphos »

I'm getting some error outputs from debconf and dpkg-preconfigure on using

Code: Select all

mintupdate-tools -l123 -y upgrade
running from the root crontab. I think this is because the output is being written to an email output and the command is expecting to have an interactive window terminal. The actual upgrade of components does appear to work correctly - should I be concerned?

Code: Select all

2 security        webkit2gtk                                    2.16.6-0ubuntu0.16.04.1
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be upgraded:
  libjavascriptcoregtk-4.0-18 libwebkit2gtk-4.0-37 libwebkit2gtk-4.0-37-gtk2
3 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
Need to get 24.7 MB of archives.
After this operation, 16.4 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 libwebkit2gtk-4.0-37-gtk2 i386 2.16.6-0ubuntu0.16.04.1 [9,519 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 libwebkit2gtk-4.0-37 i386 2.16.6-0ubuntu0.16.04.1 [11.7 MB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 libjavascriptcoregtk-4.0-18 i386 2.16.6-0ubuntu0.16.04.1 [3,496 kB]
debconf: Unable to initialise frontend: Dialog
debconf: (TERM is not set so the dialogue frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: Unable to initialise frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: Unable to re-open stdin: 
Fetched 24.7 MB in 2s (8,321 kB/s)
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 243816 files and directories currently installed.)
Preparing to unpack .../libwebkit2gtk-4.0-37-gtk2_2.16.6-0ubuntu0.16.04.1_i386.deb ...
Unpacking libwebkit2gtk-4.0-37-gtk2:i386 (2.16.6-0ubuntu0.16.04.1) over (2.16.3-0ubuntu0.16.04.1) ...
Preparing to unpack .../libwebkit2gtk-4.0-37_2.16.6-0ubuntu0.16.04.1_i386.deb ...
Unpacking libwebkit2gtk-4.0-37:i386 (2.16.6-0ubuntu0.16.04.1) over (2.16.3-0ubuntu0.16.04.1) ...
Preparing to unpack .../libjavascriptcoregtk-4.0-18_2.16.6-0ubuntu0.16.04.1_i386.deb ...
Unpacking libjavascriptcoregtk-4.0-18:i386 (2.16.6-0ubuntu0.16.04.1) over (2.16.3-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Setting up libjavascriptcoregtk-4.0-18:i386 (2.16.6-0ubuntu0.16.04.1) ...
Setting up libwebkit2gtk-4.0-37:i386 (2.16.6-0ubuntu0.16.04.1) ...
Setting up libwebkit2gtk-4.0-37-gtk2:i386 (2.16.6-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
smurphos
Level 14
Level 14
Posts: 5243
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: mintupdate-tool scripts / cron

Post by smurphos »

Not sure if it's me totalling misunderstanding the syntax or if mintupdate-tool is buggy in it's first release but yesterday it did the following things that I did not expect when running from the root crontab

Code: Select all

mintupdate-tool -r list
failed to list a level 4 kernel update that was available in the GUI Update Manager at the time.

Code: Select all

mintupdate-tool -y -l123 upgrade
upgraded a level 4 package as-well as the available level 2 package.

In the Update Manager GUI my default preferences are show all levels, select 1-4, and show and select all security and kernel updates.

Am I missing something?
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
smurphos
Level 14
Level 14
Posts: 5243
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: mintupdate-tool scripts / cron

Post by smurphos »

Edit - added the PATH declaration which I'd neglected to note is not included in a root crontab by default and is essential for this work properly.

Solved sort of...

Code: Select all

PATH="/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin"
mintupdate-tool -r -k -s -l 12345 list && mintupdate-tool -l 123 -y upgrade
does want I want it to do....

it appears that irrespective of GUI update manager settings you need to specify -k to see kernel updates. I've included -s and -l 12345 to cover all bases. I want to know about every available upgrade

to limit the actual automated upgrade to levels 1-3 the correct argument is -l 123 not -l123.....
Last edited by smurphos on Fri Apr 13, 2018 9:35 am, edited 1 time in total.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

14652474a56
Level 1
Level 1
Posts: 2
Joined: Fri Apr 13, 2018 8:21 am

Re: [SOLVED] mintupdate-tool scripts / cron

Post by 14652474a56 »

For anyone coming here from Google and trying to make this work, the command that smurphos posted only worked in the crontab if I ran the upgrade portion as sudo.

So instead of:

Code: Select all

mintupdate-tool -r -k -s -l 12345 list && mintupdate-tool -l 123 -y upgrade
I used:

Code: Select all

mintupdate-tool -r -k -s -l 12345 list && sudo mintupdate-tool -l 123 -y upgrade

Otherwise I would get this dpkg warning:

Code: Select all

dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable

User avatar
smurphos
Level 14
Level 14
Posts: 5243
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: [SOLVED] mintupdate-tool scripts / cron

Post by smurphos »

Are you using the root crontab or a user crontab?
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

14652474a56
Level 1
Level 1
Posts: 2
Joined: Fri Apr 13, 2018 8:21 am

Re: [SOLVED] mintupdate-tool scripts / cron

Post by 14652474a56 »

Are you using the root crontab or a user crontab?
I am using the root crontab.

User avatar
smurphos
Level 14
Level 14
Posts: 5243
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: [SOLVED] mintupdate-tool scripts / cron

Post by smurphos »

Thanks,

I've just had a quick check of my current root crontab. The reason it works for me as written is the PATH declaration which is also in the root crontab. Both those packages are in /sbin/.

Code: Select all

PATH="/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin"
MAILTO="me@myisp.com"
0 5 * * 6 update_rclone_cron.sh
0 4 * * * /sbin/shutdown -r +5
0 3 * * * mintupdate_cron.sh

Code: Select all

$ whereis ldconfig
ldconfig: /sbin/ldconfig /sbin/ldconfig.real /usr/share/man/man8/ldconfig.8.gz

Code: Select all

$ whereis start-stop-daemon
start-stop-daemon: /sbin/start-stop-daemon /usr/share/man/man8/start-stop-daemon.8.gz
The system crontab in /etc/crontab has this PATH set by default. I'm not sure why it's not in user or root crontabs by default. I guess I added it a long time ago when I first messed around with crontab.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

Post Reply

Return to “Software & Applications”