Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-02-2005, 11:06 PM
|
#1
|
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Rep:
|
simple cron question
if i set a crontab -e job to look as follows will it run the service every 30min?
30 * * * * command -cron
???
i hope that is simple. i basically need to run something every 30min, if this is not how it is done, please advise me. i looked here:
http://www.unixgeeks.org/security/ne...ix/cron-1.html
but could not get the */30 * * * to work that gave me an error:
Quote:
Cron also supports 'step' values.
A value of */2 in the dom field would mean the command runs every two days
and likewise, */5 in the hours field would mean the command runs every
5 hours.
e.g.
* 12 10-16/2 * * root backup.sh
is the same as:
* 12 10,12,14,16 * * root backup.sh
*/15 9-17 * * * root connection.test
Will run connection.test every 15 mins between the hours or 9am and 5pm
|
i was trying to get something like the last line example there to run.
|
|
|
|
03-02-2005, 11:10 PM
|
#2
|
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Quote:
if i set a crontab -e job to look as follows will it run the service every 30min?
30 * * * * command -cron
|
No, that would run at 30 minutes past every hour.
*/30 * * * * command -cron This will run every 30 minutes.
|
|
|
|
03-03-2005, 01:02 AM
|
#3
|
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Original Poster
Rep:
|
ok, then i must of done something wrong the first time around to get an error.
*/30 * * * * svc -t /service/imapssl -cron
that would reset the imapssl server every 30min is that correct?
|
|
|
|
03-03-2005, 08:17 AM
|
#4
|
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Quote:
|
*/30 * * * * svc -t /service/imapssl -cron
|
That's the correct time setup. I don't know about your command though. I don't seem to have a command called svc on FC3 . Normally, to restart a service I use the command like this...
service smb restart. You do want to use the full path in a cron job so that would look like this..
*/30 * * * * /sbin/service smb restart ## example
|
|
|
|
03-03-2005, 09:55 AM
|
#5
|
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Original Poster
Rep:
|
yes that would be true, but IMAPssl is one of those funky servies:
Code:
(root@mail) 1 ~ # svc -t /service/imapssl/
(root@mail) 2 ~ # service imapssl restart
imapssl: unrecognized service
(root@mail) 3 ~ # services imapssl restart
services: Command not found.
(root@mail) 4 ~ # service
Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]
(root@mail) 5 ~ # service imapssl restart
imapssl: unrecognized service
according to this URL about qmail:
http://cr.yp.to/qmail/faq/admin.html the svc -t /service/SERVICE_HERE is the proper way to reset something for qmail like the imapssl server.
why is it that cron is telling me that svc -t does not exsist, yet as you can seei can type it in exactly as i have it in my cron job and it works flawlessly.
|
|
|
|
03-03-2005, 10:35 AM
|
#6
|
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Cron probably can't find the path to svc. Try to find it with the command: whereis svc
Put the path which it shows in the cron job.
|
|
|
|
03-03-2005, 11:04 AM
|
#7
|
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Original Poster
Rep:
|
ok so the full path will be:
Code:
/usr/local/bin/svc -t /service/imapssl
and look like */30 * * * * /usr/local/bin/svc -t /service/imapssl/
|
|
|
|
03-03-2005, 11:05 AM
|
#8
|
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Original Poster
Rep:
|
ok that did not work either. just got this error from cron (its set to send me an e-mail every time it has an error
Quote:
|
svc: warning: unable to chdir to service/imap*: file does not exist
|
|
|
|
|
03-03-2005, 11:30 AM
|
#9
|
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Do a whereis service and use the full path to that also.
|
|
|
|
03-03-2005, 12:33 PM
|
#10
|
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Original Poster
Rep:
|
turned out that crontab -e is the user cron job and does not have the same PATH$ as the user does. in my case root.
i had to call someone on my LUG to get help, but the bottom line was he created a sh script that told the cron job were to find the svc -t /service/imapssl and to run that.
after he did that cron liked what it was told as it now had the information for the PATH$ thanks to the script.
thank you for all the help.
|
|
|
|
| Thread Tools |
Search 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
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:55 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|