LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 03-07-2008, 03:09 PM   #1
BlackHatRob
Member
 
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:

#script
#!/bin/bash
lsof > /root/file

#cron entry
* * * * * /root/lsof.sh | 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
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

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



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

Original Poster
Rep: Reputation: 15
Touche'

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.
 
  


Reply


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


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

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