Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-07-2008, 03:09 PM   #1
Registered: Feb 2005
Posts: 36

Rep: Reputation: 15
'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.
Old 03-07-2008, 03:20 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Try specifying the full path to lsof inside your script.

Old 03-07-2008, 04:03 PM   #3
Registered: Feb 2005
Posts: 36

Original Poster
Rep: Reputation: 15

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
lsof in Solaris champak Solaris / OpenSolaris 2 02-04-2008 09:52 PM
lsof permission champak Programming 4 11-26-2007 02:57 AM
What to do when lsof fails.... SpacedCowboy Linux - Security 2 10-29-2005 02:39 PM
Cronjob won`t work in /var nodger Linux - Software 3 11-02-2004 06:44 PM
lsof and fuser do not work with /dev/dsp alexrait1 Slackware 4 10-09-2004 04:07 PM > Forums > Linux Forums > Linux - Software

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration