Re: poudriere won;t run as cron

From: Bob Proulx <bob_at_proulx.com>
Date: Thu, 06 Feb 2025 01:45:09 UTC
Paul Macdonald wrote:
> I'm struggling to get my poudriere scripts running from cron (as root)
> a copy of your script and cron entry would probably be a good first step
> for others to try to help you out.
...
> It's nothing exotic and they run fine manually, so i'm assuming something in
> my environment.

You might be correct, but see below.  If the environment is suspected
then one should compare the environment environment on the command
line to the environment run by the cron job.  Run this for a minute
and then remove it to clean up.  Then compare the environments.  This
runs the command every minute until it is removed.

    * * * * * env > /var/tmp/cron.env.out

Something that works on the command line might need (or at least want)
one of those variables when run by cron.  Don't forget to clean it up
after the investigation has yielded the environment information.

> /bin/sh: portmasterfail.txt: not found

Look to see where this file exists.  That would be a clue as to the
problem.  The shell is trying to read it.  If it does not exist at all
then that is one type of problem.  If it exists but not in the right
directory or the program is not running in the right directory then
that is a different problems.

I suspect this is the first file in the directory and was matched by
the "*" file glob.  But it is not executable and not in PATH therefore
the shell failed to find it and reported the error.

> 20 12 * * * * /home/paul/portal_scripts/poudriere/update.ports.sh
> 00 18 * * * *   /home/paul/portal_scripts/poudriere/bulk.sh

I count 00 18 * * * * as SIX fields.  But /etc/crontab (which I assume
because you said it is running as root and I do not see a user in the
sixth field) should have FIVE fields.

Put this at the top of your crontab as an easy decoder ring to make
the mapping more clear in the future. :-)

# field descriptions
# minute (0-59),
#   hour (0-23),
#     day of the month (1-31),),
#       month of year (1-12),
#         day of the week (0-6 with 0=Sunday).

It feels a little strange to my sensibilities to be running these
scripts as root when they are located in your non-root home directory.
But whatever!

Good luck! :-)
Bob