Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #175294
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | kushal@locationd.net |
| Newsgroups | linux.debian.user |
| Subject | Re: Detect upgradable packages in shell script ran as a non-root user |
| Date | Thu, 01 Dec 2016 06:20:01 +0100 |
| Message-ID | <sJrWN-7OY-3@gated-at.bofh.it> (permalink) |
| References | <sJeGd-7Ih-25@gated-at.bofh.it> |
| X-Mailbox-Line | From debian-user-request@lists.debian.org Thu Dec 1 05:18:08 2016 |
| Old-Return-Path | <kushal@locationd.net> |
| X-Amavis-Spam-Status | No, score=-5.307 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, GMAIL=1, LDO_WHITELIST=-5, RDNS_NONE=0.793] autolearn=no autolearn_force=no |
| X-Policyd-Weight | using cached result; rate: -6.1 |
| Dkim-Signature | v=1; a=rsa-sha256; c=simple/simple; d=locationd.net; s=scandium; t=1480569472; bh=VL6gFoHSvzUWdgJD54bJFgfaqsnOBNuwkuhOKCt4+r8=; h=From:To:Subject:References:Date:In-Reply-To:From; b=vnODwDFdvTlHM/937fktq4vLluPBEV1qE9iryAc7/vh+QUwXoSjC/87tBXjJXkDjM bkM2R7RrGalaotBcFBhfomxDfV62lTDCDZg2WslZZrMmiaJLQxrLyoDd5A/tlAhmgb WbhMIZaG+YcS1Dh+asbU4EiHNwteVg7K4LbFExu0= |
| Dkim-Signature | v=1; a=rsa-sha256; c=simple/simple; d=locationd.net; s=scandium; t=1480569472; bh=VL6gFoHSvzUWdgJD54bJFgfaqsnOBNuwkuhOKCt4+r8=; h=From:To:Subject:References:Date:In-Reply-To:From; b=vnODwDFdvTlHM/937fktq4vLluPBEV1qE9iryAc7/vh+QUwXoSjC/87tBXjJXkDjM bkM2R7RrGalaotBcFBhfomxDfV62lTDCDZg2WslZZrMmiaJLQxrLyoDd5A/tlAhmgb WbhMIZaG+YcS1Dh+asbU4EiHNwteVg7K4LbFExu0= |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
| MIME-Version | 1.0 |
| Content-Type | text/plain |
| X-Mailing-List | <debian-user@lists.debian.org> archive/latest/714863 |
| List-ID | <debian-user.lists.debian.org> |
| List-URL | <https://lists.debian.org/debian-user/> |
| List-Archive | https://lists.debian.org/msgid-search/87zikgdy81.fsf@locationd.net |
| Approved | robomod@news.nic.it |
| Lines | 33 |
| Organization | linux.* mail to news gateway |
| Sender | robomod@news.nic.it |
| X-Original-Date | Thu, 01 Dec 2016 10:47:50 +0530 |
| X-Original-Message-ID | <87zikgdy81.fsf@locationd.net> |
| X-Original-References | <CAJx5YvG2VpJo+GozG+gm4HA1K5S+DOPK2obKDnFb-cm2pQvpww@mail.gmail.com> |
| Xref | csiph.com linux.debian.user:175294 |
Show key headers only | View raw
Martin T <m4rtntns@gmail.com> writes:
> Hi,
>
> I would like to run a cron job which periodically checks if I have
> upgradable packages. One way to do it is probably like this:
>
> $ apt-get upgrade -s | grep -q "^0 upgraded"
>
> In case exit code is >0, then there are upgradable packages. The
> second solution I came up with is:
>
> $ for package in $(dpkg-query -f '${binary:Package}\n' -W); do\
> apt-show-versions -u "$package" &>/dev/null && break;\
> done
>
> Again, if exit code is >0, then there is at least one upgradable
> package. Of course, a solution like "apt-show-versions | grep -q
> "upgradeable"" would also work.
>
> For me the "apt-get upgrade -s | grep -q "^0 upgraded"" seems to be
> the most reasonable solution, but maybe there is even a better way?
>
Does "apt list --upgradable" suit your needs?
Its output format is not stable and it produces a WARNING on stderr if
you use it in a pipe, which might disqualify it for cron usage, but I
use it when I'm check things by hand.
--
regards,
kushal
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Detect upgradable packages in shell script ran as a non-root user Martin T <m4rtntns@gmail.com> - 2016-11-30 16:10 +0100
Re: Detect upgradable packages in shell script ran as a non-root user Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-30 16:20 +0100
Re: Detect upgradable packages in shell script ran as a non-root user Shin Ice <shin.ice@shinice.net> - 2016-11-30 16:40 +0100
Re: Detect upgradable packages in shell script ran as a non-root user Liam O'Toole <liam.p.otoole@gmail.com> - 2016-11-30 18:50 +0100
Re: Detect upgradable packages in shell script ran as a non-root user Joe <joe@jretrading.com> - 2016-11-30 19:40 +0100
Re: Detect upgradable packages in shell script ran as a non-root user kushal@locationd.net - 2016-12-01 06:20 +0100
Re: Detect upgradable packages in shell script ran as a non-root user Tixy <tixy@yxit.co.uk> - 2016-12-02 09:00 +0100
RE: Detect upgradable packages in shell script ran as a non-root user Bonno Bloksma <b.bloksma@tio.nl> - 2016-12-02 12:40 +0100
Re: Detect upgradable packages in shell script ran as a non-root user Jonathan Dowland <jmtd@debian.org> - 2016-12-02 12:50 +0100
csiph-web