0

I have created a Shell Script as below

Sample.sh

  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

user1093513
  • 127
  • 2
  • 4
  • 12

1 Answers1

0

The first maybe you can script invocation at the top e.g. #!/bin/sh. Its required in file bash.

After you can run as:

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

If you run not okey. You can check stackoverflow.com/11932056#11932056

Community
  • 1
  • 1
Richbest
  • 151
  • 10