-   Linux - Software (
-   -   'lsof' doesn't work in cronjob (

BlackHatRob 03-07-2008 04:09 PM

'lsof' doesn't work in cronjob
I have the following example script set up in a cronjob that runs every minute:

lsof > /root/file

#cron entry
* * * * * /root/ | tee /root/thisfile

After every minute, the file '/root/thisfile' is created but there is nothing in it. No matter how many different ways I try I cannot get the output of 'lsof' to show up when running in a cronjob.

Tinkster 03-07-2008 04:20 PM

Try specifying the full path to lsof inside your script.


BlackHatRob 03-07-2008 05:03 PM


I figured that as the script was being run by root whose path includes /usr/sbin that it would have run.

Thanks for your help.... It's been a long day.

All times are GMT -5. The time now is 11:11 PM.