question about a cron job

question about a cron job

Post by Mike Challi » Mon, 10 Apr 2000 04:00:00



I would like to make a CRON job to turn off my public chatroom on Tuesdays
and Thursdays .
I have not done it yet, I want to ask you if it looks right
Can the "mv" command be used this way, or does it have to "cd" to the DIR
first?
I would use crontab -e to set it up on this Linux apache web server

# turn chatroom off and install chat closed message
# at 5 min after midnight on tuesdays and thursdays rename chatroom
index.html so it is turned off

5 0 * * 2,4 mv /home/httpd/html/ptcruise/htdocs/echat41/public/index.html
off.html

# at 6 min after midnight on tuesdays and thursdays put chatroom closed
message as the index.html

6 0 * * 2,4 mv /home/httpd/html/ptcruise/htdocs/echat41/public/chatoff.html
index.html

# turn chat room back on
# at 5 min after midnight on wednesdays and fridays rename chatroom
index.html back to chatoff

5 0 * * 3,5 mv /home/httpd/html/ptcruise/htdocs/echat41/public/index.html
chatoff.html

# at 6 min after midnight on wednesdays and fridays put the origional
chatroom index back

6 0 * * 3,4 mv /home/httpd/html/ptcruise/htdocs/echat41/public/off.html
index.html

Thanks,

Mike

 
 
 

question about a cron job

Post by Mark Semmle » Mon, 10 Apr 2000 04:00:00


Hi!

Quote:

> I would like to make a CRON job to turn off my public chatroom on Tuesdays
> and Thursdays .
> I have not done it yet, I want to ask you if it looks right
> Can the "mv" command be used this way, or does it have to "cd" to the DIR
> first?

Looks alright. You can use it like this.
Of course you should check, if the user apache can access all files.
You'll do the best, if you make a "su apache" and execute these actions
manually for testing them.

And if you want to get a report, just enter something like:

5 0 * * 2,4 mv /my/file_a /my/file_b && echo "File /my/nice/file moved"

Then apache will get mails. You can redirect them to another user (maybe
to your account) by putting

MAILTO=challis

at the beginning of the user's crontab. :)

Mark

Mike Challis schrieb:
...

Quote:> Thanks,

> Mike

________________________________________________________________________

Mark Semmler                            tel:   +49 - 6151 / 86 00 00
Linux Competence Center                 fax:   +49 - 6151 / 86 00 499

frontsite AG                            
Gesellschaft f. Informationssysteme     mobil: +49 - 177 / 20 80 291

64331 Weiterstadt (Germany)             web:   http://www.frontsite.de

 
 
 

question about a cron job

Post by Mike Challi » Mon, 10 Apr 2000 04:00:00


Thanks everybody

I found a different way

I had a friend modify the perl script for the chatroom to check the day of
the week and display the off URL on the right days.

Mike


Quote:> I would like to make a CRON job to turn off my public chatroom on Tuesdays
> and Thursdays .
> I have not done it yet, I want to ask you if it looks right
> Can the "mv" command be used this way, or does it have to "cd" to the DIR
> first?
> I would use crontab -e to set it up on this Linux apache web server

> # turn chatroom off and install chat closed message
> # at 5 min after midnight on tuesdays and thursdays rename chatroom
> index.html so it is turned off

> 5 0 * * 2,4 mv /home/httpd/html/ptcruise/htdocs/echat41/public/index.html
> off.html

> # at 6 min after midnight on tuesdays and thursdays put chatroom closed
> message as the index.html

> 6 0 * * 2,4 mv

/home/httpd/html/ptcruise/htdocs/echat41/public/chatoff.html

- Show quoted text -

Quote:> index.html

> # turn chat room back on
> # at 5 min after midnight on wednesdays and fridays rename chatroom
> index.html back to chatoff

> 5 0 * * 3,5 mv /home/httpd/html/ptcruise/htdocs/echat41/public/index.html
> chatoff.html

> # at 6 min after midnight on wednesdays and fridays put the origional
> chatroom index back

> 6 0 * * 3,4 mv /home/httpd/html/ptcruise/htdocs/echat41/public/off.html
> index.html

> Thanks,

> Mike

 
 
 

1. Difference between cron job and real time job

I have a problem, when i submit a cron job to run a command the result always show some error. But issue the command in the shell everything is normal. Anybody can tell me what's the difference between cron job and real time job.

Chris kwan

--
***************************************************
Chris C.H. Kwan
Varitronix Limited
Information Service Department

Phone  : (+852) 2197-6213
Fax    : (+852) 2343-9555

URL    : http://www.varitronix.com
***************************************************

2. problem with login

3. Lazy Question: PPP turning it on and off by CRON job.

4. ('tip question')How to connect with number?

5. Question of cron job: Can I set the output?

6. Automatically mounting smb shares . . .

7. Simple cron job question

8. Grafik

9. Basic redirect question: stderr to /dev/null in cron job

10. fancy cron job question

11. Question about NFS remote cron job

12. Cron Job Question

13. Cron Jobs Newbie Questions