LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-28-2005, 12:02 PM   #1
rainwoman
LQ Newbie
 
Registered: Sep 2005
Posts: 2

Rep: Reputation: 0
Unhappy Sheduling a .sh to run every 4 hours


Hi,

Im a complete newbie to Linux,so hope that somebody can help:
There is a .sh script that needs to run every couple of hours to restart a service that runs on our linux server.
It resides in the /jsmith/maintenance folder.

How do I schedule this to run daily every 4 hours?
Many thanks in advance
 
Old 09-28-2005, 12:21 PM   #2
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Rep: Reputation: 30
crontab -e

You would probably use something like crontab -e
(but without knowing the script its hard to give more detailed help).

# File: crontab-file. Execute your.sh every four hours.
* */4 * * * /jsmith/maintenance/your.sh

Last edited by rioguia; 09-28-2005 at 12:22 PM.
 
Old 09-28-2005, 01:48 PM   #3
rainwoman
LQ Newbie
 
Registered: Sep 2005
Posts: 2

Original Poster
Rep: Reputation: 0
.swp file..

Hi there,
thanks !. I verified the vixie-cron-3.0.1-69 service was installed and running and found the crontab file. When I opened it in VI i found that there was already a line in there to run the .sh script that restarts the service i need to get restarted every 4 hours.
The problem was that the crontab file was readonly so I couldnt add another entry to it.
I was logged in as root and entered chmod u=rwx and was then able to modify the crontab file and save it with the additional line to restart the service one hour from now so i can test its worknig ok.
When i open the crontab file in VI now, i get the below message.
can you advise what I should do next ? I cant find the .swp file anywhere !

Found a swap file by the name ".crontab.swp"

owned by: root dated: Wed Sep 28 17:44:27 2005

file name: /etc/crontab

modified: YES

user name: root host name: radservbakup

process ID: 32021

While opening file "crontab"

Cdated: Wed Sep 28 18:18:53 2005

NEWER than swap file!


(1) Another program may be editing the same file.

If this is the case, be careful not to end up with two

different instances of the same file when making changes.

Quit, or continue with caution.


(2) An edit session for this file crashed.

If this is the case, use ":recover" or "vim -r crontab"

to recover the changes (see ":help recovery").

If you did this already, delete the swap file ".crontab.swp"

to avoid this message.


23;1H"crontab" 31L, 1202C
 
  


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
A few hours in and i broke it... Linux_n00b_57 Linux - Newbie 5 06-29-2005 12:24 AM
I Need Help Fast!!! I Have Less Than 24 Hours bioagentice Linux - General 6 03-07-2005 10:33 AM
How many hours a day???????? JrLz General 15 04-13-2004 01:42 PM
about Linux sheduling eshwar_ind Programming 7 02-11-2004 04:46 AM
how many hours does it take ? sapilas Linux - Distributions 2 06-08-2002 11:26 AM


All times are GMT -5. The time now is 02:39 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration