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-02-2005, 11:37 AM   #1
viniosity
Member
 
Registered: Oct 2001
Location: Washington, DC
Distribution: Debian, Archlinux, Ubuntu, Sidux
Posts: 244

Rep: Reputation: 30
automate script w/ cron


I have a script called 'faxscript' that I want cron to run every 20 minutes.

I used crontab -e to put this in:
Code:
#run faxscript to send faxes every 20 minutes between 3am and 10pm
*/20 3-22 * * *  . /usr/local/faxqueue/faxscript
unfortunately that's not working for some reason. Do I need to type something specific to get the script to run? i.e. maybe remove the . before the /usr?

Also, can anyone tell me how to make it run every 20 minutes around the clock instead of just between 3am and 10pm?
 
Old 02-02-2005, 11:56 AM   #2
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
yes, get rid of the dot, and change to
*/20 * * * * /usr/...
 
Old 02-02-2005, 12:07 PM   #3
viniosity
Member
 
Registered: Oct 2001
Location: Washington, DC
Distribution: Debian, Archlinux, Ubuntu, Sidux
Posts: 244

Original Poster
Rep: Reputation: 30
Ok, I tried that and it tries to run it (just to test I changed it to every 5 minutes)

Code:
*/5 * * * *     /usr/local/faxqueue/faxscript
I get an email saying that permission is denied when trying to execute the script:

Code:
Subject: Cron <root@tuxfaxer> /usr/local/faxqueue/faxscript
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

/bin/sh: line 1: /usr/local/faxqueue/faxscript: Permission denied
It's in root's crontab and I can manually run it as root and so I'm not sure why that would be happening. Do I need to rename the file faxscript.sh or something? Maybe change the ownership for it? Else, does cron default to running it as non-root?
 
Old 02-02-2005, 12:10 PM   #4
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
how do you run it as root?
 
Old 02-02-2005, 12:11 PM   #5
viniosity
Member
 
Registered: Oct 2001
Location: Washington, DC
Distribution: Debian, Archlinux, Ubuntu, Sidux
Posts: 244

Original Poster
Rep: Reputation: 30
well, as root I ran crontab -e

I just tried inserting the root name into the crontab to see if that would work:

Code:
*/5 * * * * root        /usr/local/faxqueue/faxscript
edit: that didn't work either. It tells me root is a bad command or filename.

Last edited by viniosity; 02-02-2005 at 12:27 PM.
 
Old 02-02-2005, 03:13 PM   #6
viniosity
Member
 
Registered: Oct 2001
Location: Washington, DC
Distribution: Debian, Archlinux, Ubuntu, Sidux
Posts: 244

Original Poster
Rep: Reputation: 30
Ok, so I found out that only /etc/crontab supports the username feature. So I tried it there but got the same error. Next I just changed the permissions to 775. The good news is I no longer get a permissions error. The bad news is the script still doesn't seem to be executed. I say seem b/c I'm not getting an error email of any kind the output of the cron job (which faxes a file then erases it) still doesn't work.
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
how to automate telnet login, script or something kiwibird Linux - Networking 2 11-09-2005 02:02 PM
PPPD Script problem when cron-scheduling the script andresurzagasti Linux - Networking 0 11-24-2004 02:54 PM
Kermit Script to Automate FTP SSL/TLS fiddelm3742 Linux - Software 0 05-18-2004 11:53 PM
Script that would automate adding users zyft02 Linux - Newbie 4 02-25-2002 11:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:55 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
Open Source Consulting | Domain Registration