GIDForums  

Go Back   GIDForums > Web Hosting Forums > Web Hosting Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 13-Jan-2003, 18:44
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Create a batch file on linux


How would I do that? Appreciate any examples you can offer...
  #2  
Old 13-Jan-2003, 18:53
Elmseeker's Avatar
Elmseeker Elmseeker is offline
Awaiting Email Confirmation
 
Join Date: Jan 2003
Posts: 87
Elmseeker is on a distinguished road
Err...no such thing as "batch file" you'd have to use shell scripts, I'll see if I can dig up one of my old ones in a few minutes...what you need it for anyway? Maybe there's a better way...

Ok, found an old one, all it does is find empty files and put a header into them...

#!/bin/bash

for i in *
do
head --lines 1 <$i >/tmp/head.tmp
mv /tmp/head.tmp $i
done
Last edited by Elmseeker : 13-Jan-2003 at 18:57.
  #3  
Old 13-Jan-2003, 18:59
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
i want to run something every 24 hours...

So this 'shell script' it's in a file or something??
  #4  
Old 13-Jan-2003, 19:08
Elmseeker's Avatar
Elmseeker Elmseeker is offline
Awaiting Email Confirmation
 
Join Date: Jan 2003
Posts: 87
Elmseeker is on a distinguished road
Yes it's in a file, I expected that's what you wanted!

Make a file in your directory called crontab, it should contain the following:

0 0 * * * /path/to/file/to/execute &

This will run the file every 24 hours at midnight server time...to change the time simply change one of the first 2 numbers, first is minutes, second is hours, use 24 hour time format...the *'s are for day of the month, month and day of the week in that order so you could set it to run say...fridays at midnight

5 0 * * 5 $HOME/bin/daily.job >> $HOME/tmp/out 2>&1

Sunday is day 0 AND day 7
Enjoy!
  #5  
Old 13-Jan-2003, 19:14
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Whoa there... first tell me about this file...

it's mysample.job or mysample.anything?
  #6  
Old 13-Jan-2003, 19:19
Elmseeker's Avatar
Elmseeker Elmseeker is offline
Awaiting Email Confirmation
 
Join Date: Jan 2003
Posts: 87
Elmseeker is on a distinguished road
Can be anything at all, lol, and I am psting too fast?!?! It said sorry can only post every 60 seconds and I had just posted a reply tosomething else lol...*is too fast for these boards* *cracks a whip over the boards* MUSH! Ya! MUSH!
  #7  
Old 13-Jan-2003, 19:31
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
so now, if my website was hosted at:

Code:
/home/username/public_html/index.html

Where would this CRONTAB dir have to be?
  #8  
Old 13-Jan-2003, 19:51
Elmseeker's Avatar
Elmseeker Elmseeker is offline
Awaiting Email Confirmation
 
Join Date: Jan 2003
Posts: 87
Elmseeker is on a distinguished road
the crontab file always goes in your $HOME directory aka /home/username
  #9  
Old 13-Jan-2003, 19:59
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Excellent, unfortunately I have to leave, so I will take this up with you later on. Thanks Elm.
 

Recent GIDBlogNARMY by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to boot Linux in text mode with GRUB Loader JdS Computer Software Forum - Linux 8 11-Jul-2006 04:41
Changing monitors on a Linux machine JdS Computer Software Forum - Linux 10 23-Dec-2004 09:49
How to create batch files without DOS box? rhino1616 Web Design Forum 3 18-Aug-2003 10:00
RESELLER Specials - Create your own Resellers 1GB disk space 10GB transfer $10/Month IEAN.net Web Hosting Advertisements & Offers 0 19-May-2003 13:32
How Do i get php to find out the file type of a file for me? viperman95833 MySQL / PHP Forum 2 08-Mar-2003 09:48

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:36.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.