cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

1281
Views
0
Helpful
1
Replies
Nazmul Rajib
Cisco Employee

Running Qualys Connecter via Cron Job Fails

Running a Qualys Connector manually succeeds, but when I try to automate it using cron, I receive the following error:

Can't locate SFCheckPreReq.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at <path to connector>/qualys_connector.pl line 8.
 
BEGIN failed--compilation aborted at <path to connector>/qualys_connector.pl line 8.

The <path to connector> in the above output is the location where I have installed the connector.

1 REPLY 1
Nazmul Rajib
Cisco Employee

There is one special concern, when running the Qualys Connector via cron, rather than directly.  Specifically, the Qualys Connector script has several libraries in a sub-directory, that it requires. When you run it by hand, these sub-directories are relative to the current directory (known as . and is the last entry in the @INC path). When run from cron, however, that is not the current directory.

 

There is a simple solution, prepend a cd <path to connector> command to the cron entry. For instance, assume:

  1. The Qualys connector is installed in /home/qconn/
  2. There is currently a cron entry that reads:
0 5 * * * /home/qconn/qualys_connector.pl

 The cron entry needs to be updated to read:

0 5 * * * cd /home/qconn/; ./qualys_connector.pl
Create
Recognize Your Peers
Content for Community-Ad