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.

Required fields*

5
  • What do you mean by "does not work"? Error messages? Zero output? Please tell us Commented Apr 4, 2021 at 14:54
  • 1
    Instead of using user pi's crontab, use root's: sudo crontab -e That way, your script already has root access and you don't need to use sudo. Commented Apr 4, 2021 at 14:56
  • 1
    Using more does not make sense since a web page isn't interactive. You probably want crontab -l or sudo crontab -l -u pi. (Or sudo cat /var/spool/cron/crontabs/pi, though technically that only works by accident and other distributions have their crontabs in other locations.) Commented Apr 4, 2021 at 15:59
  • The sudo command does give zero output. I can put a line in the .sh file that starts with sudo and there is zero output in the php file. When I put a rsync command it is also not executed. But from the command line it works. To update my question: How can I get output of a line that has to start with sudo? Commented Apr 4, 2021 at 17:20
  • crontab -e will also not work because you're asking to edit the crontab -- from a noninteractive shell. Commented Jan 7 at 14:32