I have created a Shell Script as below


  echo "Hi there"

I also added cron job in cron tab which is under /etc/crontab as below

* * * * * /home/Sample.sh > /home/Sample.txt

I have created the Sample.txt file in /home/ directory.

I have also checked the permission for read and write for both the file

When I execute the Sample.sh file it works fine.it writes in Sample.txt file

Now I don't understand why it is not writing in the Text file from the cron task i scheduled

I am using Ubuntu 10.04

Please Help me in fixing this issue


You are using the system crontab which has a slightly different format; specifically, the date-time fields must be followed by a user field which tells cron who to run the command that follows as.

So the syntax in this case should be something like:

* * * * * username /home/username/Sample.sh > /home/username/Sample.txt
| improve this answer | |

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.