Take the 2-minute tour ×

My Script contents are:

ant -buildfile /home/kris/Desktop/myproject/build.xml run   

If I open the terminal and type: bash myscript.sh, then it runs fine. But when I set it for cron job, it doesn't open the terminal. But generates the output log fine. What I want is that after setting the cron, myscript.sh would run automatically at specific time. It will open the terminal and run the command ant -buildfile /home/kris/Desktop/myproject/build.xml run

Contents of my cron file are:

* 9 5 * * /home/kris/Desktop/myproject/myscript.sh  > /home/kris/Desktop/output/output.sh

Build.xml runs my testng.xml and testng.xml runs my scripts written in java. I am working on Ubuntu machine.

share|improve this question
cron is made for run tasks without terminal/console in background. Why do you need the terminal ? –  PeterMmm Apr 5 '13 at 6:04
And there might be no terminal available for you, e.g. because you are not logged in at the moment the cron job is running and some other user is logged (and uses many terminals). –  Basile Starynkevitch Apr 5 '13 at 6:18
You need to indicate the binary executing the script: * 9 5 * * /bin/bash /home/kris/Desktop/myproject/myscript.sh ... –  fedorqui Apr 5 '13 at 8:21
add comment

Your Answer



Browse other questions tagged or ask your own question.