On Thursday 22 June 2006 21:25, Gilberto I. Monroy Lopez wrote:
Hi all
I need your help, I have a problem with cron, it doesnt execute all of the script specially all of the "for sentences", the crontab show this:
root#crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.18434 installed on Thu Jun 22 19:31:06 2006) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) 29 17 * * * /root/borradum.sh * * * * * /root/monitor/monitoreo.sh * * * * * finger >> ~/monitor/hola.log
My script is monitoreo.sh and it works
root#more monitoreo.sh #!/bin/bash touch /root/monitor/hola2.log for HOST in `cat hosts.conf |awk '{print $1}'` do echo $HOST touch /root/monitor/hola3.log /root/monitor/recolector.sh -h $HOST echo "`cat hosts.conf | grep -i $HOST | awk '{print $2}'`" > /root/monitor/host.dat /root/monitor/generalogs.sh done
And the messages says that the cron ran the script well, so, the problem is tha it just did the touch command but the sentence "for" didnt, so whats happening? doesnt the cron run scripts with "for" and "whiles" sentences, whats wrong?
Jun 22 19:55:00 lnxportal /USR/SBIN/CRON[23873]: (root) CMD (/root/monitor/monitoreo.sh )
I would appreciate if anybody can help me. Thanks in advance
[...] cat hosts.conf [...] What is the current working directory when the script is executed by cron? ? ? I don't see a "cd" in the script to change it, so are you sure the script is looking at the correct location of the file, hosts.conf ? -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com