LinuxQuestions.org
Review your favorite Linux distribution.
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 02-22-2005, 09:24 PM   #1
Eduardo911
LQ Newbie
 
Registered: Aug 2003
Posts: 12

Rep: Reputation: 0
ok, quick tutorial, never done this before


i know this is rudimentary but if someone could step by step me how to do this it would be great.

right now i have a ut2k4 server running and inorder to update the stats page, i have to first copy all the .log files to another folder, then run php on a file there to make it update the database. basically, here are the two commands that need to run:

cp /usr/games/ut2k4/UserLogs/*.log /home/user/utstats/Logs
php /home/user/utstats/logs.php pass=password

now what i need is some way to make my system run these two commands every hour, lets say on the hour for ease of things. just run one, then when its finished, run the other.

things to take into account, i'd like it to automatically overwrite the .log files when it copies them just incase something had screwed up before and theres some left.

basically i dont know how to get all these to run on a schedule automatically. i'm sure it involves cron somehow but every time i go editing that other things seem to break so i've been wary of going into it again without a little assistance.



oh man that is the best emote ever
 
Old 02-22-2005, 09:31 PM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 46
start here:
$ man cron
$ man crontab
then google for something like 'cron crontab tutorial introduction'
 
Old 02-22-2005, 09:32 PM   #3
DoubleOTeC
Member
 
Registered: Aug 2003
Location: Dominica
Distribution: RedHat, FC1, FC3, FC4
Posts: 266

Rep: Reputation: 30
Setting up the two commands to run could be done as simply as creating a lil shell script.
Code:
#!/bin/sh
cp /usr/games/ut2k4/UserLogs/*.log /home/user/utstats/Logs
php /home/user/utstats/logs.php pass=password
As for the hourly part, there may be a folder in your distro within which the scripts are run every hour. (/etc/cron.hourly for example) Copying or linking that script in would pretty much take care of that problem.

Hope this helps...lemme know..
 
Old 02-22-2005, 09:43 PM   #4
Eduardo911
LQ Newbie
 
Registered: Aug 2003
Posts: 12

Original Poster
Rep: Reputation: 0
oh ok i do have a /etc/cron.hourly its just an empty file.

so just vi that and stick those two lines in and thats it?
 
Old 02-22-2005, 09:52 PM   #5
Eduardo911
LQ Newbie
 
Registered: Aug 2003
Posts: 12

Original Poster
Rep: Reputation: 0
cool, works thanks!
 
Old 02-22-2005, 09:54 PM   #6
DoubleOTeC
Member
 
Registered: Aug 2003
Location: Dominica
Distribution: RedHat, FC1, FC3, FC4
Posts: 266

Rep: Reputation: 30
I think cron.hourly may be a directory.

You're on the right track with regards to vi-ing a file.

Putting the lines into the file, and make the file executable. Copying, moving or linking it into the cron.hourly directory will make it run.
 
Old 02-22-2005, 10:05 PM   #7
Sphyrix
LQ Newbie
 
Registered: Jan 2005
Posts: 9

Rep: Reputation: 0
I am sure you probably came across the following site. If otherwise, Cron

Cheers
 
  


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
looking for a tutorial maximus1u2 Linux - Newbie 5 03-16-2005 11:44 AM
QT tutorial vinsky2002 Linux - Software 2 03-02-2005 04:15 AM
Quick and dirty tutorial on networking? neocookie Linux - Networking 2 08-27-2004 08:22 AM
Need help w/tutorial FreakboY Programming 10 05-10-2004 06:30 PM
How about a weekly tutorial? or just a tutorial Alinuxnoob LQ Suggestions & Feedback 2 04-09-2002 09:30 PM


All times are GMT -5. The time now is 09:56 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