LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 04-01-2005, 04:40 AM   #1
b:z
Member
 
Registered: Mar 2005
Posts: 146

Rep: Reputation: 15
Crontab - How can i run the scheduled file? - Please help me


I have 2 separate policies in squid: policy1 anf policy 2, so i want to run policy1 during working hours, and anther after working.
How can i run it. This is the detail

2 policied:
policy1 ----run---- : squid1.conf
policy2 ----run---- : squid2.conf

Time:
working hours ----time--- : 8:30a.m - 6:30p.m
free hours ----time--- : 6:30p.m - 8:30a.m

Please give me the tip for this. Thanks so much.

Note: Beside what else solution can i do it?
 
Old 04-01-2005, 04:49 AM   #2
kbcnetau
Member
 
Registered: Dec 2003
Location: South Australia (ex-Devon, UK)
Distribution: SuSE, Slackware, Fedora, Debian, Knoppix
Posts: 141

Rep: Reputation: 15
Squid supports time-based ACLS - check the Squid documentation for details.
 
Old 04-01-2005, 05:02 AM   #3
b:z
Member
 
Registered: Mar 2005
Posts: 146

Original Poster
Rep: Reputation: 15
Yes, i know. However i want to run 2 file at different time, how can i do it?
Thanks so much.
 
Old 04-01-2005, 05:14 AM   #4
shiva_4palz
LQ Newbie
 
Registered: Dec 2004
Location: india
Posts: 2

Rep: Reputation: 0
Reload Squid conf files

Just try to create a sym link to squid1.conf to squid.conf in the morning for policy 1 and reload squid.
Similiarly create sym link squid2.conf to squid.conf in the evening for policy 2 and reload squid.


the syntax for sym link would be ln -sf /etc/squid1.conf /etc/squid.conf and /etc/init.d/squid reload

all of this can be neatly clubbed in a small shell script.

regards,
shiva
 
Old 04-01-2005, 05:17 AM   #5
b:z
Member
 
Registered: Mar 2005
Posts: 146

Original Poster
Rep: Reputation: 15
Thanks for your reply,
How about crontab? How can i enable them to run with the specific time and with specific sym link?

Please help me.
 
Old 04-01-2005, 05:22 AM   #6
kbcnetau
Member
 
Registered: Dec 2003
Location: South Australia (ex-Devon, UK)
Distribution: SuSE, Slackware, Fedora, Debian, Knoppix
Posts: 141

Rep: Reputation: 15
See: man crontab
 
Old 04-01-2005, 05:23 AM   #7
shiva_4palz
LQ Newbie
 
Registered: Dec 2004
Location: india
Posts: 2

Rep: Reputation: 0
2 policied:
policy1 ----run---- : squid1.conf
policy2 ----run---- : squid2.conf

Time:
working hours ----time--- : 8:30a.m - 6:30p.m
free hours ----time--- : 6:30p.m - 8:30a.m


Small bash script

/tmp/morning.sh
#!/bin/bash

ln -sf /etc/squid1.conf /etc/squid.conf
/etc/init.d/squid reload

=====================
/tmp/evening.sh
#!/bin/bash

ln -sf /etc/squid2.conf /etc/squid.conf
/etc/init.d/squid reload

====================
crontab entries crontab -e

29 08 * * * /tmp/morning.sh
29 18 * * * /tmp/evening.sh

Enjoy

Have Fun
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What does the run-parts mean in crontab? mTorbin Linux - Newbie 15 04-27-2012 03:53 PM
Cron - doesn't seem to run scheduled tasks robintw Linux - General 11 11-25-2005 01:53 AM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 03:42 AM
How to run useradd from crontab? adrianphicks Linux - Enterprise 3 08-03-2004 12:00 AM
Can't run F-Prot with Crontab maxflex Slackware 7 07-31-2004 10:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:25 PM.

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
Open Source Consulting | Domain Registration