From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ales Stibal Subject: Re: Why want my iptables scripts run in cron Date: Mon, 24 Mar 2003 17:03:39 +0100 Sender: netfilter-admin@lists.netfilter.org Message-ID: <3E7F2C5B.9040601@giganet.cz> References: <200303182201.19202.dlm4444@bigzoo.net> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200303182201.19202.dlm4444@bigzoo.net> Errors-To: netfilter-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: david Cc: netfilter@lists.netfilter.org david wrote: >I have a simple script called routup.sh to start the routing at a certain >time, it is excutable. It runs fine at the command line but not cron. here is >what my cron entry looks like: 0 9 * * * root /etc/routup.sh What is the reason to run this script in cron? ;-) >#routup.sh >#!/bin/bash > >echo 1 > /proc/sys/net/ipv4/ip_forward >iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE At first look: remove the first line. Let the #!/bin/bash be at the first instead of #routup.sh. BTW: why do you run bash? Run sh. It's not error in fact, but the sh usage is something like idiom. AFAIK sh is link to your default shell, probably bash. >I even went as far to add a path to the crontab file like this: >vi crontab >/sbin/iptables. This looks strange to me. Could you send more info if the stuff above wont help? >where am i going wrong. >The o.s. is linux mandrake 9.0 > >thanks for any help, Hope this helps, Astib(); -- A l e s S t i b a l, Wintel free, powered by AthlonXP and Gentoo Linux. Giganet.cz community network, Litomerice, Czech Republic