And I see mail in /var/spool/mail/nobody/new telling me that the first one there failed because php is no on the PATH. I created the second cron job to figure out what the environment looked like. It looks like this:
Thank you again, @aanderse! I’m having some problems executing my script (due to include_path or something), so I tried cd’ing into the directory first. Like this:
While actually commenting out my own environment there, and the output was:
Sep 02 19:20:06 myvps systemd[520630]: myjob.service: Failed to locate executable env: No such file or directory
I’ve googled a bit to try to understand what type of environment the systemd service will run in, but I’m not getting any smarter. Do you have any pointers?
Sure. You’re looking for serviceConfig.WorkingDirectory = "${domain1-source.source-code}/path_to_crons";.
If you want to see your full environment for a systemd service you can run systemctl cat myjob.service.
Keep in mind that NixOS tries to sandbox as much as possible, so any commands your php scripts might need won’t be available unless you explicitly make it available.