Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsLinux 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:
  #1  
Old July 11th, 2012, 09:37 AM
andreas.london andreas.london is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 64 andreas.london User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
Smile Crontab

hi, i have update.txt file with perl script, and i want to use crontab to schedule that file run every 1 hour. how can i do that? please help!!!!

Reply With Quote
  #2  
Old July 11th, 2012, 12:11 PM
safesurfdns safesurfdns is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 15 safesurfdns User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m 55 sec
Reputation Power: 0
Quote:
Originally Posted by andreas.london
hi, i have update.txt file with perl script, and i want to use crontab to schedule that file run every 1 hour. how can i do that? please help!!!!


1. Perl scripts don't have .txt extensions. Rename it .pl
2. chmod +x it
3. you'll have to determine when to it is supposed to run
4. crontab -e
5. create the crontab entry as specified in the man pages (man crontab)
6. Save and Exit
7. Make sure crontab service is running.

Reply With Quote
  #3  
Old July 12th, 2012, 04:08 AM
andreas.london andreas.london is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 64 andreas.london User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
Smile crontab

hi, thanks very much for you help.
i just wondering also if you know how can i email those scheduled updates to my email address???

Reply With Quote
  #4  
Old July 12th, 2012, 06:37 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 48 m 25 sec
Reputation Power: 1485
Just a small point ... you can call your script anything you want ... even iexplore.exe, *nix does not care. The only ones who will care are you and anyone else using the system.
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

Reply With Quote
  #5  
Old July 12th, 2012, 07:25 AM
andreas.london andreas.london is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 64 andreas.london User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
thanks very much for the tip!

Quote:
Originally Posted by SimonJM
Just a small point ... you can call your script anything you want ... even iexplore.exe, *nix does not care. The only ones who will care are you and anyone else using the system.

Reply With Quote
  #6  
Old July 12th, 2012, 07:44 AM
safesurfdns safesurfdns is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 15 safesurfdns User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m 55 sec
Reputation Power: 0
Quote:
Originally Posted by SimonJM
Just a small point ... you can call your script anything you want ... even iexplore.exe, *nix does not care. The only ones who will care are you and anyone else using the system.


While this is true, it's definitely not good practice. Sysops come and go, properly identifying files is key to a successful administration team. If there is no particular reason to name the file ambiguously (like security reasons) my 2 cents is that you name it appropriately. It's just a good habit to get into.

Reply With Quote
  #7  
Old July 12th, 2012, 07:57 AM
andreas.london andreas.london is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 64 andreas.london User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
hm. i see! ok thanks a lot! Can you please help me as well with the email using cron?
Quote:
Originally Posted by safesurfdns
While this is true, it's definitely not good practice. Sysops come and go, properly identifying files is key to a successful administration team. If there is no particular reason to name the file ambiguously (like security reasons) my 2 cents is that you name it appropriately. It's just a good habit to get into.

Reply With Quote
  #8  
Old July 12th, 2012, 08:17 AM
safesurfdns safesurfdns is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 15 safesurfdns User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m 55 sec
Reputation Power: 0
Quote:
Originally Posted by andreas.london
hm. i see! ok thanks a lot! Can you please help me as well with the email using cron?


In RedHat variants crontab mails automatically if you have postfix and dovecot set up properly...

Reply With Quote
  #9  
Old July 12th, 2012, 08:35 AM
ishnid's Avatar
ishnid ishnid is offline
kill 9, $$;
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Sep 2001
Location: Shanghai, An tSín
Posts: 6,894 ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level) 
Time spent in forums: 4 Months 2 Weeks 1 Day 22 h 36 m 34 sec
Reputation Power: 3885
Quote:
Originally Posted by andreas.london
hm. i see! ok thanks a lot! Can you please help me as well with the email using cron?

In your crontab file, include the following line:
Code:
MAILTO=myemail@example.com

Reply With Quote
  #10  
Old July 12th, 2012, 09:25 AM
andreas.london andreas.london is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 64 andreas.london User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
does this command has any limitations? because i tried that before and it didn't work.
Quote:
Originally Posted by ishnid
In your crontab file, include the following line:
Code:
MAILTO=myemail@example.com

Reply With Quote
  #11  
Old July 12th, 2012, 04:56 PM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 48 m 25 sec
Reputation Power: 1485
Generally cron will only mail output from a script/binary. If your output is directed to a file then that will not do what you want - unless you then cat the file.

Reply With Quote
  #12  
Old July 13th, 2012, 06:02 AM
ishnid's Avatar
ishnid ishnid is offline
kill 9, $$;
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Sep 2001
Location: Shanghai, An tSín
Posts: 6,894 ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level) 
Time spent in forums: 4 Months 2 Weeks 1 Day 22 h 36 m 34 sec
Reputation Power: 3885
Quote:
Originally Posted by andreas.london
does this command has any limitations? because i tried that before and it didn't work.

In what way did it not work? No email at all? Wrong content?

Presumably you need to have a mailer such as exim set up.

Reply With Quote
  #13  
Old July 13th, 2012, 08:53 AM
andreas.london andreas.london is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 64 andreas.london User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
No email at all. I think it didn't work because i have to configure smtp server. if that could be a reason can you please tell me what i can do?

Quote:
Originally Posted by ishnid
In what way did it not work? No email at all? Wrong content?

Presumably you need to have a mailer such as exim set up.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Crontab

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap