LinuxQuestions.org
Visit Jeremy's Blog.
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 06-06-2007, 01:04 PM   #1
tux_processor
LQ Newbie
 
Registered: Jun 2007
Posts: 3

Rep: Reputation: 0
crontab


Hi everybody,

I am facing a problem with crontab . When I am trying to redirect the standard output for qshape(for postfix queue) command, file is created but there are no contents in the file.

The crontab entry is:

Code:
*/1     *     *     *     *      /usr/bin/qshape > log.txt

now the file log.txt is created with no contents, However if I run the command

Code:
  qshape > log.txt

I find certain contents in the file.

Can anybody help me out?

thanks in advance.
 
Old 06-06-2007, 01:05 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
What does this command do exactly?

Try doing:

*/1 * * * * /usr/bin/qshape >> log.txt
 
Old 06-06-2007, 01:32 PM   #3
tux_processor
LQ Newbie
 
Registered: Jun 2007
Posts: 3

Original Poster
Rep: Reputation: 0
When I tried


Code:
*/1     *     *     *     *      qshape 2> log.txt

i.e. redirecting the error. I found
Code:
/bin/bash: command not found

actually qshape command was located in /usr/sbin/.

thanks anyway!
 
Old 06-06-2007, 09:28 PM   #4
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by tux_processor
When I tried


Code:
*/1     *     *     *     *      qshape 2> log.txt

i.e. redirecting the error. I found
Code:
/bin/bash: command not found

actually qshape command was located in /usr/sbin/.

thanks anyway!
Ok so in your first response you have your crontab listing the command in /usr/bin and now it's in /usr/sbin

Why did you try it without the full complete path? When dealing with cron and crontab, it's always a good practice to put the full complete path of the command.

If it's located in /usr/sbin, perhaps having it /usr/bin was the problem, but I'm just totally confused with your followup, it made no sense to me on if you're still having problems, solved it, etc.
 
Old 06-07-2007, 01:55 AM   #5
tux_processor
LQ Newbie
 
Registered: Jun 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Hi!!

The problem was very specific to the command , I think. When I type "qshape" on shell I get:

Code:
  T  5 10 20 40 80 160 320 640 1280 1280+
                               
   TOTAL  0  0  0  0  0  0   0   0   0    0     0

it shows status of postfix queues.
I found my problem solved with the crontab entry :


Code:
 */1     *     *     *     *       /usr/sbin/qshape -c /etc/postfix /var/spool/postfix/active > /root/log3.txt
where /etc/postfix is the configuration directory and /var/spool/postfix/active is the queue directory.

While typing it on console , it takes these directories by default and in crontab it gives the error.

Last edited by tux_processor; 06-07-2007 at 01:58 AM.
 
Old 06-07-2007, 11:10 PM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by tux_processor
Hi!!

The problem was very specific to the command , I think. When I type "qshape" on shell I get:

Code:
  T  5 10 20 40 80 160 320 640 1280 1280+
                               
   TOTAL  0  0  0  0  0  0   0   0   0    0     0

it shows status of postfix queues.
I found my problem solved with the crontab entry :


Code:
 */1     *     *     *     *       /usr/sbin/qshape -c /etc/postfix /var/spool/postfix/active > /root/log3.txt
where /etc/postfix is the configuration directory and /var/spool/postfix/active is the queue directory.

While typing it on console , it takes these directories by default and in crontab it gives the error.
Hence the reason when dealing with crontab, take in account that it most likely won't be using the same environment, paths, etc that the user uses, so always use full complete commands..
 
  


Reply

Tags
cron


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab disquetes Linux - Software 1 09-12-2006 06:40 AM
about crontab shipon_97 Linux - General 1 02-28-2006 06:22 AM
Crontab kalinchuk Linux - Networking 1 02-22-2006 10:59 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 01:35 PM
Crontab WiWa Linux - Software 1 10-06-2003 06:20 PM


All times are GMT -5. The time now is 09:52 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration