BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsBSD Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 5th, 2003, 11:38 AM
jeff_papp jeff_papp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 3 jeff_papp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
the "at" command

I am trying to write a script that performs various commands. I would like to set the script to run at various times but can find a way to set this up. I would also like to keep a log file of each time the script is run. Any help on this would be great!

Reply With Quote
  #2  
Old September 5th, 2003, 12:50 PM
Prime Mover Prime Mover is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Jersey
Posts: 64 Prime Mover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Any chance you'd want to use cron instead of at? The at command seems kinda limited for repeat usage of a script, since it only accepts one argument for time, as far as I can tell. Cron would be better for you to routinely execute jobs at certain times, and is very easy to set up. man cron.

-Gary

Reply With Quote
  #3  
Old September 6th, 2003, 12:29 AM
jeff_papp jeff_papp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 3 jeff_papp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I got cron up and running, but when I run the script in the backround, i can't get it log the whole activity of the script since nothing is written to standard output. I was using tee -a to log the output of each command, which works fine if I run the script from the console, but when I run the script in the backround, nothing gets logged. What can I do to log from the backround?

Reply With Quote
  #4  
Old September 6th, 2003, 08:03 PM
Prime Mover Prime Mover is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Jersey
Posts: 64 Prime Mover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Redirect the output of the script from cron... In the crontab, make the calling line appear like so:

* * * * * * /path/to/script > /path/to/logfile.txt

That will log your output to a file which you can read later.

Or, you can alternatively log output from the script you're running as well, which will avoice the problem altogether.

-Gary

Reply With Quote
  #5  
Old September 6th, 2003, 10:48 PM
jeff_papp jeff_papp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 3 jeff_papp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ok, here is my problem. I need to run a script to ping and traceroute various site at different times of the day for one of my classes. I have a script set up that does everything, but when I set the script to output to a log file in cron, it will output certain things, like the date command, but things like ping don't output anything at all. What other ways are there to log from cron other than just script > logfile?

Reply With Quote
  #6  
Old September 7th, 2003, 01:22 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
in your /etc/crontab you can specify:
MAIL=root
Then cron will mail the outputs of the programs (if any) to root. But you can also modify the lines above to log stderr too:

* * * * * * /path/to/script > /path/to/logfile.txt 2>&1
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsBSD Help > the "at" command


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway