LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-01-2014, 12:29 PM   #1
Sir Prised
Member
 
Registered: Sep 2009
Posts: 42

Rep: Reputation: 0
Scheduling iftop


Hi

I want to run iftop from 0800 until I shutdown some time later in the day.
The simple root command is /usr/sbin/iftop -i em1 which opens it in a terminal window.

How do I create that as a root cron job.. i.e.
0 8 * * * /usr/sbin/iftop -i em1 does nothing.

Do I have to create a script for the cron job to initiate?
As you can tell, I'm out of my limited depth !

Thanks
 
Old 07-01-2014, 12:58 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
For one offs this may be easier:
Code:
echo '/usr/sbin/iftop -n -N -i em1 -t'|/usr/bin/at 08:00
Note iftop uses ncurses to display data and that may not be what you want, hence the "-t".
Once you kill the job an email will be sent with all the logged data in it.
If that isn't what you want or need then see 'man tcpdump' and capture data first and parse it later.
 
Old 07-01-2014, 01:22 PM   #3
Sir Prised
Member
 
Registered: Sep 2009
Posts: 42

Original Poster
Rep: Reputation: 0
Thanks for the reply.

Entering something first thing is OK but it would be nice for it to be scheduled.

I tried your suggestion, leaving it in an open terminal session, which returned 'job 3 at 2014-07-01 19:22'
but nothing happened at the appointed time. I would like it to open the iftop window, as the direct command does,
rather than send anything to a file.

Cheers
 
Old 07-02-2014, 02:45 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Quote:
Originally Posted by Sir Prised View Post
I tried your suggestion, leaving it in an open terminal session, which returned 'job 3 at 2014-07-01 19:22' but nothing happened at the appointed time.
Well it did happen but you probably didn't kill the process afterwards as I suggested and you probably also didn't check your email after you killed the process?..


Quote:
Originally Posted by Sir Prised View Post
I would like it to open the iftop window, as the direct command does, rather than send anything to a file.
Oh well. I won't bore you with details then but point you to 'man screen' as you need something to be able to "take over" your console even if you're not logged in and have it run 'iftop' for you.
 
Old 07-02-2014, 02:58 PM   #5
Sir Prised
Member
 
Registered: Sep 2009
Posts: 42

Original Poster
Rep: Reputation: 0
I have to say that it sounds as if you're answering the question you wish I'd ask?

i.e. I'm not looking at an email I never wanted in the first place !

Perhaps what I did ask isn't possible but hey ho, I can carry on doing it manually.

ATB
 
Old 07-03-2014, 01:43 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Quote:
Originally Posted by Sir Prised View Post
I have to say that it sounds as if you're answering the question you wish I'd ask?
i.e. I'm not looking at an email I never wanted in the first place !
That's an odd way to phrase things.
I just explained how testing that method works.
What you do with that is your choice.


Quote:
Originally Posted by Sir Prised View Post
Perhaps what I did ask isn't possible but hey ho, I can carry on doing it manually.
I pointed out one method to achieve what you want.
So maybe there's some language barrier here?..
 
  


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
[SOLVED] Non-root alternative to iftop wpost Linux - General 3 05-29-2010 06:55 PM
iftop security issue ? ALInux Linux - Security 2 01-18-2010 04:53 PM
possible to run iftop as non-root? drokmed Linux - Software 3 01-18-2010 10:25 AM
allow iftop without shell console mad_penguin Linux - Security 2 03-20-2009 03:55 AM
iftop will not load mahjong Linux - Software 0 10-16-2003 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration