Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Do you get any error message? Try to run as bash -x /home/pi/deleteoldfiles.sh &>/tmp/output to see what is going on. Commented Feb 13, 2016 at 18:21
  • i modified the sudo crontab -e with #Borrowed from anacron SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin #End borrowed from anacron # */5 * * * * /home/pi/deleteoldfiles.sh * * * * * bash -x /home/pi/deleteoldfiles.sh &>/tmp/output but in tmp/output all i can see is a blank file. Commented Feb 13, 2016 at 18:29
  • In this case you can probably simplify your question a lot. Try to replace your long script with a simple one only doing something like date >/tmp/time. This should work manually but not in cron. Commented Feb 13, 2016 at 18:53
  • add the line 'MAILTO=someone@somewhere' to the crontab file to get the output of all executed commands. This will give you a hint about whats happening. Commented Feb 13, 2016 at 19:02
  • 1
    Is the script's execute bit set? i.e. can you run it manually as ./deleteoldfiles.sh rather than bash ./deleteoldfiles.sh? Commented Feb 13, 2016 at 19:03