sakshi has asked for the wisdom of the Perl Monks concerning the following question:

i am using perl script which is scheduled on crontab..its running but in nohup.out file getting blank values..

#!/usr/bin/perl use DBI; use POSIX; $serip=`ifconfig |grep 'inet addr'`; @serip=split('\n', $serip);@serip=split(' ',$serip[0]);$sip=$serip[1]; +@serip=split('\.',$serip[1]); $sid=$serip[3]; $sip =~ s/addr://; print "ServerIP : $sip ServerID= $sid\n";
  • Comment on scheduled perl script on cron but not executing completely in background..
  • Download Code

Replies are listed 'Best First'.
Re: scheduled perl script on cron but not executing completely in background..
by Corion (Patriarch) on Sep 10, 2016 at 18:21 UTC

    crond does not write to nohup.out.

    Usually, crond sends you an email with the output of your script after it has run to completion.

Re: scheduled perl script on cron but not executing completely in background..
by fullermd (Vicar) on Sep 11, 2016 at 03:04 UTC

    cron runs with its own $PATH, which on many systems doesn't include /sbin, which is where ifconfig usually is. So is it even running ifconfig? Try a full path.