The below line should provide an output date which when run manually gives an proper output such as Fri Jul 17 01:42:07 2015. But when run using cron, it gives the epoch date i.e. Wed Dec 31 19:00:00 1969

job_date=`iwgetwfobj $i | sed -n 2p |tr -s '=' '@'|awk -F'@' '{print $6}'|tr - d \" |tr -d \>| perl -e 'print localtime(<>) . "\n";'`

Please let me know the change to be made. Any help will be appreciated.

  • insert a | tee /tmp/lets-see.log just before the | sed and see what's wrong with the second line of the output of iwgetwfobj in /tmp/lets-see.log. Aug 21, 2015 at 14:56
  • TZ=US/Eastern perl -E 'say scalar localtime(0)' indicates you're getting epoch 0 somehow. In addition to the iwgetwfobj bit, what is $i and where did it come from?
    – thrig
    Aug 21, 2015 at 16:55
  • Here $i is holding a job ID. iwgetfwjob uses the same to get information on the jobs. Further the output is processed to fetch the date of activation of the job from it Aug 24, 2015 at 7:32

2 Answers 2


The issue was resolved by putting the path before the CLT iwgetwfobj. Thanks for the help.


The cron daemon can't find iwgetwfobj, as it's not on the minimal path (/usr/bin:/bin)

Several environment variables are set up automatically by the cron(8) daemon. [...] PATH is set to "/usr/bin:/bin". [...] PATH may be overridden by settings in the crontab.

Either set PATH explicitly at the start of the crontab, or write the full pathname of iwgetwfobj and any other commands not in /bin or /usr/bin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.