Search code examples
perlubuntucron

Running perl-script kpcli via cron failed


I'd like to run a script using kpcli (http://kpcli.sourceforge.net/) via cronjob. All works fine when running it interactively.

When running it the following minimum example via cronjob I get the following error-message.

46 22 * * *     myuser /usr/local/bin/kpcli --command "vers"

Here the error message

No usable Term::ReadLine::* modules found.
This list was tried:
 * Term::ReadLine::Gnu
 * Term::ReadLine::Perl
 * Term::ReadLine::Perl5
For more information, read the documentation: perldoc kpcli

Here is the output when running it via command line

kpcli: 3.4
Perl: v5.26.1
Operating system: linux ("Ubuntu 18.04.4 LTS")
ReadLine being used: Term::ReadLine::Gnu

Pivotal Perl Modules for kpcli
 * File::KeePass: 2.03
 * Term::ShellUI: 0.92
 * Term::ReadKey: 2.37
 * Term::ReadLine: 1.16
 * Capture::Tiny: 0.48
 * Clipboard: 0.13
 * Math::Random::ISAAC: 1.003
 * Term::ReadLine::Gnu: 1.35
 * Authen::OATH: not installed (optional)
 * Sub::Install: not installed (optional)

I also tried to set the variable

PERL5LIB=/usr/lib/x86_64-linux-gnu/perl5/5.26

But nothing changed :(

What's wrong?


Solution

  • I have it :). I have unset all environment variables step by step by shell script. The result was that the variable TERM="xterm" was set in my env but not in the cron env. After setting it in cron all works fine