From nobody Sun Sep 18 16:59:47 2022 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MVvDx0sYJz4cvjW for ; Sun, 18 Sep 2022 17:00:01 +0000 (UTC) (envelope-from paulbeard@gmail.com) Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MVvDv4hL3z3cQf for ; Sun, 18 Sep 2022 16:59:59 +0000 (UTC) (envelope-from paulbeard@gmail.com) Received: by mail-ua1-x932.google.com with SMTP id a14so9646131uat.13 for ; Sun, 18 Sep 2022 09:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date; bh=zsYH52ZxwYkpY2Tn8NVMyamAppsUifbb9WxFvJI8aME=; b=OiU4sRJquW87twFY61ndBfZXvJ5VAJAYD1Ma4cHUog2kfSY96kmlpJWKqVIgHOzyNH I9/LtMSfRMQS0sNEjHjQGdZeAgfkDSIMLlbeqsPAWmfRsMEr14QppphKFH1QeQpjp8K9 EsviW0+bsc5WvHswcOEufJRw1hKBszPTStOWtCZRL4+33Zi0D1kfdaxe1MCHGbyauEhO Ut5ZltonqVoDQjzaBey1bDCiOims07mS56FzHoWy+lqQoH8TQXpsWvVhaLIiAK/jrHt1 YC2K5LjncJxfUbNURtm+IXl6ODjQMzPC41XA4NkXaxTN7zBAUHQOudNIA0wizJbazWLf 9vOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=zsYH52ZxwYkpY2Tn8NVMyamAppsUifbb9WxFvJI8aME=; b=J4XtOCz0P9fIPbdg9vIQznm3GECgsPvIvZxpKicc7Yk18g9xV8N0aKDx4xTp+TzGcj J9DrMvrrbCPUhhw81cD15/sSw0gY/i3U+qSDa8SEBGw5tBwwwdFiUK1VccoV209hd9ss w8mXOBGXS4+9bRSmFgJcEl5xXWLHvhFYv7njwWrKe3hg1IHGStHxw/C8xoDEQvAPVKT3 A72lYXPXN/d/ZrNyaBPIQfsjPf5e8fj+eHo2pAm6Eh2n+oQ6GjGz7PwrpNOT1uTw0Wwn yCPltzUVZ7bCgEGmNwsHYh+vSJE/jJysBxuHbn1brrBFybUQDU2r9OCO2sK1kCuB3sGk utGQ== X-Gm-Message-State: ACrzQf35iwDYqVJsCTFxXxt96A3j1vS7dUPwwbYpcBo7mogWYqbLcFXi DVoKCIC9gKNgh5E1FQy2jysmXdrF20896DT9yGgoj91a X-Google-Smtp-Source: AMsMyM6uS36c7qSNWucYl49T2LmrTs96FHglxS/drC2pgqOi7hZVGy32W4pseKW1htiEllKx9MtY2I5vx72rHB2g6Ck= X-Received: by 2002:ab0:1c55:0:b0:3b6:3cbe:19ca with SMTP id o21-20020ab01c55000000b003b63cbe19camr4695514uaj.114.1663520398646; Sun, 18 Sep 2022 09:59:58 -0700 (PDT) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: paul beard Date: Sun, 18 Sep 2022 09:59:47 -0700 Message-ID: Subject: Re: command works interactively but not in cron? To: paul beard , FreeBSD-questions Content-Type: multipart/alternative; boundary="00000000000070249405e8f686fc" X-Rspamd-Queue-Id: 4MVvDv4hL3z3cQf X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=OiU4sRJq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of paulbeard@gmail.com designates 2607:f8b0:4864:20::932 as permitted sender) smtp.mailfrom=paulbeard@gmail.com X-Spamd-Result: default: False [-2.98 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999]; NEURAL_HAM_MEDIUM(-1.00)[-0.996]; NEURAL_HAM_SHORT(-0.98)[-0.983]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::932:from]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; TO_DN_ALL(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_TO(0.00)[gmail.com,freebsd.org]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --00000000000070249405e8f686fc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable RTFM=E2=80=A6I should remember to do that more often. Thanks. On Sun, Sep 18, 2022 at 9:55 AM Kusalananda K=C3=A4h=C3=A4ri wrote: > On Sun, Sep 18, 2022 at 08:49:05AM -0700, paul beard wrote: > > /usr/sbin/pkg query %o works fine interactively but if I use it to > backup a > > list of installed pkgs in crontab, it fails: > > > > 00 4 * * * /usr/sbin/pkg query %o > /var/backups/installed.pkgs > > > > Usage: pkg query > > pkg query [-a] > > pkg query -F > > pkg query -e > > pkg query [-Cgix] <...> > > > > For more information see 'pkg help query.' > > > > What am I missing here? > > -- > > Paul Beard / www.paulbeard.org/ > > Escape the % > > 0 4 * * * /usr/sbin/pkg query \%o >/var/backups/installed.pkgs > > See also crontab(5) > > -- > Andreas (Kusalananda) K=C3=A4h=C3=A4ri > SciLifeLab, NBIS, ICM > Uppsala University, Sweden > > . > --=20 Paul Beard / www.paulbeard.org/ --00000000000070249405e8f686fc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
RTFM=E2=80=A6I should remember=C2=A0to do that more often.= =C2=A0

Thanks.=C2=A0

On Sun, Sep 18, 2022 at 9:55 A= M Kusalananda K=C3=A4h=C3=A4ri <andreas.kahari@abc.se> wrote:
On Sun, Sep= 18, 2022 at 08:49:05AM -0700, paul beard wrote:
> /usr/sbin/pkg query %o works fine interactively but if I use it to bac= kup a
> list of installed pkgs in crontab, it fails:
>
> 00 4 * * *=C2=A0 =C2=A0 =C2=A0 /usr/sbin/pkg query %o > /var/backup= s/installed.pkgs
>
> Usage: pkg query <query-format> <pkg-name>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 pkg query [-a] <query-format>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 pkg query -F <pkg-name> <query-for= mat>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 pkg query -e <evaluation> <query-f= ormat>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 pkg query [-Cgix] <query-format> <= pattern> <...>
>
> For more information see 'pkg help query.'
>
> What am I missing here?
> --
> Paul Beard / www.paulbeard.org/

Escape the %

=C2=A0 =C2=A0 =C2=A0 =C2=A0 0 4 * * * /usr/sbin/pkg query \%o >/var/back= ups/installed.pkgs

See also crontab(5)

--
Andreas (Kusalananda) K=C3=A4h=C3=A4ri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.


--
Paul Beard / www.paulbeard.org/
--00000000000070249405e8f686fc--