The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Operating Systems
> Linux Help
|
Crontab
Discuss Crontab in the Linux Help forum on Dev Shed. Crontab Linux Help forum discussing topics including usage, troubleshooting, modules, and distributions. Linux is an open source OS, based on UNIX.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 11th, 2012, 09:37 AM
|
|
Contributing User
|
|
Join Date: Jul 2012
Posts: 64
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
|
|
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!!!!
|

July 11th, 2012, 12:11 PM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 15
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.
|

July 12th, 2012, 04:08 AM
|
|
Contributing User
|
|
Join Date: Jul 2012
Posts: 64
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
|
|
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???
|

July 12th, 2012, 06:37 AM
|
|
|
|
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
|

July 12th, 2012, 07:25 AM
|
|
Contributing User
|
|
Join Date: Jul 2012
Posts: 64
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. |
|

July 12th, 2012, 07:44 AM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 15
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.
|

July 12th, 2012, 07:57 AM
|
|
Contributing User
|
|
Join Date: Jul 2012
Posts: 64
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. |
|

July 12th, 2012, 08:17 AM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 15
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...
|

July 12th, 2012, 08:35 AM
|
 |
kill 9, $$;
|
|
Join Date: Sep 2001
Location: Shanghai, An tSín
|
|
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
|

July 12th, 2012, 09:25 AM
|
|
Contributing User
|
|
Join Date: Jul 2012
Posts: 64
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
|
|

July 12th, 2012, 04:56 PM
|
|
|
|
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.
|

July 13th, 2012, 06:02 AM
|
 |
kill 9, $$;
|
|
Join Date: Sep 2001
Location: Shanghai, An tSín
|
|
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.
|

July 13th, 2012, 08:53 AM
|
|
Contributing User
|
|
Join Date: Jul 2012
Posts: 64
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. |
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|