I'm kinda new to ubuntu so ...

Well the issue is I need to use a script made in python and did one in bash ... neither worked on crontab to see how many IP addresses I have in my home network and the python script usually does it.

'import os

os.system("touch test.html")

os.system("nmap >> test.html")


Here is the example:  Crontab -e photo of mine

Still can't figure it out. So I tried this multiple times through youtube tutorials and this forum still nada.

  • 1
    Did you use 'crontab -e'? You may need 'sudo crontab -e' – John Anderson Feb 8 '18 at 17:15
  • 1
    @JohnAnderson Why should nmap be started as root? – dessert Feb 8 '18 at 17:17
  • 1
    Are the single quotes part of your file? If they are, remove them. Secondly, nmap will take longer than a minute to run, so you might want to change that to every 10 or so for testing. – Terrance Feb 8 '18 at 17:35
  • 1
    Another thought here, add in a location that test.html will be created like "nmap >> /home/username/test.html". As it stands, it might be creating in the working folder that cron is running in. – Terrance Feb 8 '18 at 17:42
  • 1
    Is your Py3 interpreter really located in your /home dir? – user535733 Feb 8 '18 at 18:10

You likely have a permission problem with one or more of the filenames in your python program. You should fully specify the entire path to the file test.html

To get more information you should redirect the output to a file so you can see the error messages. Otherwise check the mail system for crontab output.


* * * * * /usr/bin/python3 /home/luisgio/jobs/nmap.py > /tmp/nmap.log 2>&1

Also: Check that /usr/bin/python3 is installed on your system. We assume the program works from the command line.


is the wrong path. You probably want

/usr/bin/python3 /home/luisgio/jobs/nmap.py

as you want the python interpreter to load your script.

  • Thank you for the help but still nada – Luis Carlos Feb 8 '18 at 17:22
  • Besides, I'd rather recommend not to run crontab every minute... And if you really want to troubleshoot it, it is highly recommended to add log of cronJob as following /usr/bin/python3 /home/luisgio/jobs/nmap.py >> >> /var/log/yourLogFolder/nmap.log 2>&1 – Alvaro Niño Feb 8 '18 at 17:22
  • Try to log it and see what is the output – Alvaro Niño Feb 8 '18 at 17:23
  • Nope, still nothing – Luis Carlos Feb 8 '18 at 17:26
  • My lucky guess is that the folder that im trying to execute doesnt work due to its locations – Luis Carlos Feb 8 '18 at 17:26

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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