From owner-freebsd-questions@FreeBSD.ORG Fri Oct 27 10:38:45 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BD08516A412 for ; Fri, 27 Oct 2006 10:38:45 +0000 (UTC) (envelope-from zbyszek@szalbot.homedns.org) Received: from lists.lc-words.com (lists.lc-words.com [83.19.156.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B71A43D4C for ; Fri, 27 Oct 2006 10:38:45 +0000 (GMT) (envelope-from zbyszek@szalbot.homedns.org) Received: from [127.0.0.1] (helo=localhost) by lists.lc-words.com with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1GdP6p-000IZY-63 for freebsd-questions@freebsd.org; Fri, 27 Oct 2006 12:38:43 +0200 Date: Fri, 27 Oct 2006 12:38:43 +0200 (CEST) From: Zbigniew Szalbot X-X-Sender: zbyszek@192.168.11.51 To: freebsd-questions@freebsd.org Message-ID: <20061027123200.P71098@192.168.11.51> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: system crontab X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2006 10:38:45 -0000 Hello, I would like to daily run a certain script that cleans exim's queue from frozen messages: sudo exiqgrep -i -z | sudo xargs -L 1 exim -Mrm I have created a file called rm_frozen_msg.sh, gave it appropriate permissions and then installed it in my user crontab. Because it did not work I read the man and found out that I cannot run scripts as another (root) user. Therefore I edited /etc/crontab to instruct it to run the file daily. At first, it did not like sudo. As I was running it under user root anyway, I deleted sudo from the file. Then it complained about exiqgrep so I put the full path: /usr/local/sbin/ But my question is why can I run the command sudo exiqgrep -i -z | sudo xargs -L 1 exim -Mrm from the command line but I cannot use it in a file with cron? Thanks! -- Zbigniew Szalbot