[rancid] Issues running rancid from cron on Ubuntu..
Alan McKinnon
alan.mckinnon at gmail.com
Thu Jun 16 17:48:13 UTC 2016
On 16/06/2016 19:33, Howard Leadmon wrote:
> Maybe this will be an easy one for someone to answer, I can hope. I
> had rancid for years running on FBSD, but recently moved over on to a
> current Ubuntu server. I moved my configs across, and have it so if
> from a shell prompt I perform a rancid-run life is good, it’s seeing all
> the gear, and saving cofigs, and emailing updates to me.
>
> The problem is when I toss rancid-run into cron, it spits errors and
> will not read the configs. So it’s for sure an issue of this being
> kicked into cron, but using google-fu I am finding nothing. I even
> tried not calling the symlink but calling the main executable directly,
> but still no difference.
>
> Here is the error I see in the rancid.log file if I let this execute
> from cron:
>
> starting: Thu Jun 16 12:31:02 EDT 2016
>
> Trying to get all of the configs.
>
> no such variable
>
> (read trace on "env(USER)")
>
> invoked from within
>
> "add user * $env(USER)"
>
> ("eval" body line 1)
>
> invoked from within
>
> "eval $line"
>
> (procedure "source_password_file" line 21)
>
> invoked from within
>
> "source_password_file $password_file"
>
> (file "/usr/lib/rancid/bin/clogin" line 853)no such variable
>
> (read trace on "env(USER)")
>
> invoked from within
>
> "add user * $env(USER)"
>
> ("eval" body line 1)
>
> invoked from within
>
> "eval $line"
>
> (procedure "source_password_file" line 21)
>
> invoked from within
>
> "source_password_file $password_file"
>
> (file "/usr/lib/rancid/bin/clogin" line 853)
>
> switch-1: missed cmd(s): all commands
>
> switch-1: End of run not found
>
> !
>
> This ONLY happens when I execute from cron, if done locally in a shell,
> all works perfectly.
>
> In crontab, I simply have the time and path to rancid-run.
>
> Any ideas?
There's usually only one thing that every causes this - the shell
environment. A login shell comes with all manner of convenient envvars
like PATH that make a human's life easier.
cron usually runs in a bare-bones shell with very little in the way of
an environment (by design) meaning you can't rely on user shortcuts like
PATH.
Or it could be as simple as cron doesn't use the same shell you do.
You'll have to examine your system with this in mind and see where
things differ. It's difficult to get more specific than that at this
stage given the information available.
Alan
More information about the Rancid-discuss
mailing list