Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shell script that runs nmap on an address, and I want to have it do it daily for me. So I added a reference to it in my crontab.

Unfortunately, for some reason it doesn't recognize the arguments I'm sending to nmap. While it runs fine when I run it explicitly, it errors in cron on the first argument.

Cron entry:

0 3 * * * /home/directedition/observatory/ # JOB_ID_1


today=$(date +"%Y-%m-%d")
touch $tempfilename
chmod 640 $tempfilename
/usr/bin/nmap -A -T5 -O -v -oX $tempfilename > /home/directedition/observatory/nmapoutput.txt
chown directedition $tempfilename
chmod 644 $tempfilename
mv $tempfilename $filename

Error: nmap: invalid option -- 'A'

I can shuffle the arguments around, and whichever I put first will invariably error.

share|improve this question
Can you edit your post with the exact CRON entry, as well as your complete script file? – Aaron Apr 9 '13 at 12:33

Try to use the full path of the executing program like:

0 3 * * * /bin/bash /home/directedition/observatory/ # JOB_ID_1

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.