Re: command works interactively but not in cron?

From: paul beard <paulbeard_at_gmail.com>
Date: Sun, 18 Sep 2022 16:59:47 UTC
RTFM…I should remember to do that more often.

Thanks.

On Sun, Sep 18, 2022 at 9:55 AM Kusalananda Kähäri <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
> 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/
>
> Escape the %
>
>         0 4 * * * /usr/sbin/pkg query \%o >/var/backups/installed.pkgs
>
> See also crontab(5)
>
> --
> Andreas (Kusalananda) Kähäri
> SciLifeLab, NBIS, ICM
> Uppsala University, Sweden
>
> .
>


-- 
Paul Beard / www.paulbeard.org/