Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Sep 2022 08:49:05 -0700
From:      paul beard <paulbeard@gmail.com>
To:        FreeBSD-questions <freebsd-questions@freebsd.org>
Subject:   command works interactively but not in cron?
Message-ID:  <CAMtcK2oLAopL9rO4SzJxzL30FpJ0YjrmybajQ6LJzeehNzKnGA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--00000000000091a49d05e8f589d3
Content-Type: text/plain; charset="UTF-8"

/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 <query-format> <pkg-name>
       pkg query [-a] <query-format>
       pkg query -F <pkg-name> <query-format>
       pkg query -e <evaluation> <query-format>
       pkg query [-Cgix] <query-format> <pattern> <...>

For more information see 'pkg help query.'

What am I missing here?
-- 
Paul Beard / www.paulbeard.org/

--00000000000091a49d05e8f589d3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">/usr/sbin/pkg query %o works fine interactively but if I u=
se it to backup a list of installed pkgs=C2=A0in crontab, it fails:=C2=A0<d=
iv><br></div><div>00 4 * * * =C2=A0 =C2=A0 =C2=A0/usr/sbin/pkg query %o &gt=
; /var/backups/installed.pkgs<br><div><br></div><div>Usage: pkg query &lt;q=
uery-format&gt; &lt;pkg-name&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0pkg query [-=
a] &lt;query-format&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0pkg query -F &lt;pkg-=
name&gt; &lt;query-format&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0pkg query -e &l=
t;evaluation&gt; &lt;query-format&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0pkg que=
ry [-Cgix] &lt;query-format&gt; &lt;pattern&gt; &lt;...&gt;<br><br>For more=
 information see &#39;pkg help query.&#39;<br clear=3D"all"><div><br></div>=
<div>What am I missing here?=C2=A0</div>-- <br><div dir=3D"ltr" class=3D"gm=
ail_signature" data-smartmail=3D"gmail_signature">Paul Beard / <a href=3D"h=
ttp://www.paulbeard.org/" target=3D"_blank">www.paulbeard.org/</a><br></div=
></div></div></div>

--00000000000091a49d05e8f589d3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMtcK2oLAopL9rO4SzJxzL30FpJ0YjrmybajQ6LJzeehNzKnGA>