Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Sep 2022 18:55:41 +0200
From:      Kusalananda =?utf-8?B?S8OkaMOkcmk=?= <andreas.kahari@abc.se>
To:        paul beard <paulbeard@gmail.com>
Cc:        FreeBSD-questions <freebsd-questions@freebsd.org>
Subject:   Re: command works interactively but not in cron?
Message-ID:  <YydNjbA/eEcM%2Bc3l@harpo.local>
In-Reply-To: <CAMtcK2oLAopL9rO4SzJxzL30FpJ0YjrmybajQ6LJzeehNzKnGA@mail.gmail.com>
References:  <CAMtcK2oLAopL9rO4SzJxzL30FpJ0YjrmybajQ6LJzeehNzKnGA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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

.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YydNjbA/eEcM%2Bc3l>