LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-09-2007, 12:11 AM   #1
Dogar
Member
 
Registered: Feb 2007
Posts: 56

Rep: Reputation: 15
cron utility


hi all

i want to use cron utility to run this command at 2am after a weak
the command is
#SquidGuard -C all

plz help me in making file and where is it placed and how it run .....


reguards

Bilal
 
Old 04-09-2007, 12:17 AM   #2
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Just add a line to /etc/crontab as root. Search Google for what each of the fields in this file mean, and use the existing lines as a template.

You will want something like:
Code:
0 2 * * 0 "squidguard -C all"
Which will run the command every Sunday at 2am.

If this is not what you were after, can you give us more info.

--Ian
 
Old 04-09-2007, 12:24 AM   #3
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Just insert into /etc/crontab using crontab -e command.

http://www.tech-geeks.org/contrib/md...ntab-howto.htm
... above is a howto for using cron and crontab.


Something like:

0 2 * * 0 /path/to/SquidGuard -C all

should run squidguard at 2am every sunday.
(you may want this in the root users crontab though)

Last edited by Simon Bridge; 04-09-2007 at 06:06 AM.
 
Old 04-09-2007, 04:41 AM   #4
Dogar
Member
 
Registered: Feb 2007
Posts: 56

Original Poster
Rep: Reputation: 15
i try both the methods but not work

can you give me more details........

0-59/1 * * * * "squidGuard -C all"

actuly i am testing it on every mint


waiting for your replay



bilal
 
Old 04-09-2007, 04:49 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
0-59/1 * * * * "/path/to/squidGuard -C all"
 
Old 04-09-2007, 05:22 AM   #6
Dogar
Member
 
Registered: Feb 2007
Posts: 56

Original Poster
Rep: Reputation: 15
hellow
Mr.tredegar

thanks for your replay.i try this one but it also not work can u gove me more help
i will be very thankfull to you



bilal
 
Old 04-09-2007, 05:32 AM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Whose crontab are you editing? Yours or root's?
Who does the program SquidGuard belong to (ls -l SquidGuard)
Post the exact line you are using in the crontab that you say is not working
 
Old 04-09-2007, 05:44 AM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You shouldn't need the quotes in the crontab line. Try

0-59/1 * * * * /path/to/squidGuard -C all
 
Old 04-09-2007, 06:07 AM   #9
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Please read the howto in my last post.

More information is needed if anyone is to help you.
 
Old 04-10-2007, 12:53 AM   #10
Dogar
Member
 
Registered: Feb 2007
Posts: 56

Original Poster
Rep: Reputation: 15
hi all
in my crontab file only this command is present

0-59/1 * * * * "/usr/local/squidGuard/squidGuard -C all"

but this not work
 
Old 04-10-2007, 01:30 AM   #11
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
We really need more information from you to help. "Here is the line, it doesn't work" doesn't tell us anything.

What happens if you try to run "squidGuard -C all" manually as root (ie not through crontab)?

Have you looked at the howto that was linked above? What parts of it do you not understand?

Check roots mailbox - cron by default will email the output of the command to root.

Also, if you want to run the command every minute, just replace the 0-59/1 bit with a * like in the other fields. * means every minute.

--Ian
 
Old 04-10-2007, 02:17 AM   #12
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
0-59/1 * * * * "/usr/local/squidGuard/squidGuard -C all"
0-59 * * * * root /path/to/SquidGuard -C all

???
Did you use crontab -e to edit /etc/crontab?

I notice that you have failed to follow advise that was given you and failed to provide details asked for. The question before us now is: why should we help you?
 
Old 04-10-2007, 03:26 AM   #13
Dogar
Member
 
Registered: Feb 2007
Posts: 56

Original Poster
Rep: Reputation: 15
hi simon bridge

i am telling all about i do to use cron utinlity

i am a root user

i run the follling command as root

#crontab -e

an editor open and i write the following code in it. just one line of code

0-59/1 * * * * root /usr/local/squidGuard/squidGuard -C all

there is nothing more in it

when i exit after saving this file folloeing message is

crontab: installing new crontab

these is all i done but it still not work

can u tell me about cron.hourly and cron.weakly?
 
Old 04-10-2007, 04:56 AM   #14
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Quote:
Originally Posted by Dogar
hi simon bridge

i am telling all about i do to use cron utinlity

i am a root user

i run the follling command as root

#crontab -e

an editor open and i write the following code in it. just one line of code

0-59/1 * * * * root /usr/local/squidGuard/squidGuard -C all

there is nothing more in it

when i exit after saving this file folloeing message is

crontab: installing new crontab

these is all i done but it still not work

can u tell me about cron.hourly and cron.weakly?
1) Read the howto linked by Simon Bridge in post #3.

2) Answer the questions in my above post. In particular, does the command work if you run it manually. Do you get any messages in root's mail to give you the output of the above comand? You must answer these questions if we are to help you further.

3) Any scripts placed in /etc/cron.daily will be run once per day at the time specified in /etc/crontab. Likewise, scripts in /etc/cron.weekly are run once per week at the time specified in /etc/crontab.
 
Old 04-11-2007, 02:35 AM   #15
Dogar
Member
 
Registered: Feb 2007
Posts: 56

Original Poster
Rep: Reputation: 15
hi iball

yes "squidGuard -C all" run sucessfuly manualy
i can understand all the contents of link given by simon bridge

but i dose not know how to check mail that generatd by cron to root
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
cron file 000-delay.cron (it is on my FC5) - what is the purpose? jtmoon Linux - Server 1 03-08-2007 11:15 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM
problem with using cron utility ahmedb72 Red Hat 3 01-30-2006 12:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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