0

I created a crontab which runs the file "NEW" at 9:05 in the morning daily. Now this file new creates a file "currentdate" which has the current date in it. But I am not able to understand why the file new is not executing and currentdate don't gets created.

crontab I created is- 5 9 * * * /user/project/new

"new" file is as follows and is located at /user/project.

#!/bin/bash

date > currentdate 
Anant
  • 3
  • 3
  • Is NEW executable? Is it in the PATH that cron has available to it (hint: It's not necessarily the path of the user). Is this an entry in crontab, or is it something like a /etc/crontab.d file? In which case, what's that file's name? – Michael Kohne Jul 27 '15 at 13:28
  • Did you check permissions? Which users crontab is the cron entry in and what are the permissions on the "new" script? – Jose Martinez Jul 27 '15 at 13:29
  • the file is probably created in `/`. You better indicate the full path of the output file: `date > /home/you/currentdate`. – fedorqui Jul 27 '15 at 13:30
  • @Jose Martinez Yes its executable, it is a script. It has all the permissions. And if i manually run the script "new". The file currentdate gets created with current date in it. – Anant Jul 27 '15 at 13:35
  • I have also checked the crontab list, with command " crontab -l" . It shows the command but nothing happens time passes by and no file gets craeted. – Anant Jul 27 '15 at 13:36
  • Would you be able to add the following line `touch /tmp/somenewfile` to the script and see if that file is present? I just want to see if the problem is with crontab calling the script or if the problem is with the "date > currentdate". – Jose Martinez Jul 27 '15 at 13:43
  • @fedorqui Thanks,it worked by adding the full path of the ouput file. date > /home/you/currentdate. Thankyou Everyone :) – Anant Jul 27 '15 at 13:52
  • Nice :) Just marked as duplicate to another one that had the same problem. In the future, you may want to go through [Debugging crontab](http://stackoverflow.com/tags/crontab/info) – fedorqui Jul 27 '15 at 13:55

0 Answers0