First, many thanks for all prompt replies.... I solved the problem by using the extremely same PATH value under commandline for cron file. Right now, it works perfectly. Here are my files:
[EMAIL PROTECTED] logs]# crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.606 installed on Thu Mar 11 11:57:40 2004) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) SHELL=/bin/bash #PATH here is totally the same as echo $PATH PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X 11R6/bin:/root/bin MAILTO=root HOME=/ # run-parts #minute hour day month dayofweek command #0-59 0-23 1-31 1-12 0-7 /usr/local/sbin/nessusd.8 58 * * * * /nessus/nessus-auto/nessus-autorun.bash [EMAIL PROTECTED] logs]# cat /nessus/nessus-auto/nessus-autorun.bash #!/bin/bash cd /nessus/nessus-auto echo `pwd` HOST=192.168.1.110 PORT=1241 USR=scan PWD=scan IPLIST=iplist_scan NSRFILE=iplist_$(date +%m%d%Y_%H:%M:%S)".nsr" echo $NSRFILE nessus -V -c /nessus/nessus-auto/.nessusrc -q $HOST $PORT $USR $PWD $IPLIST $NSRFILE > /root/word echo finish the scan echo parser result #nsr_format_perl is a homemade script to parse nsr file. perl nsr_format_perl $NSRFILE exit [EMAIL PROTECTED] logs]# head -20 /nessus/nessus-auto/.nessusrc # This file was automagically created by nessus trusted_ca = /usr/local/com/nessus/CA/cacert.pem paranoia_level = 1 nessusd_host = 192.168.1.110 nessusd_user = scan begin(SCANNER_SET) 10180 = no 10277 = no 10278 = no 10331 = no 10335 = yes 10841 = no 10336 = no 10796 = no 11219 = no 11840 = yes end(SCANNER_SET) begin(PLUGIN_SET) 10015 = yes .... I found something interesting in this ordeal: When I used my old cron setting, I found nessus communicated with nessusd but seemed waiting something... I piped the nessus result to /root/word, and found it asked me to accept the certification or not. But my .nessusrc file has the explicit path for the certification file. I doubt that is the problem screwing me for a long time. When I used the new cronfile path setting, problem solved. My confusion is: I think my old cron path has already covered the system PATH value, why it dosen't work? old: PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/:/nessus/nessus-auto new: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X 11R6/bin:/root/bin BTW: > Why call bash explicitly when you use it implicitly as part of the script? Do you happen to have multiple bash versions? Though it is a little naive to call bash explicitly, it won't hurt according to my experience. Many thanks. Jian _______________________________________________ Nessus mailing list [EMAIL PROTECTED] http://mail.nessus.org/mailman/listinfo/nessus
