cloverdev The only matter is that the executable is run with a prepared environment so yes.
Great! When is the server rebooted, since I assume that's when the job is run?
I'm not sure if I understand your question correctly. The cron job with @reboot is executed after the server is restarted (following its reboot).
To specify, I meant when the server gets rebooted.
So according to the response, use cron with @reboot, this has also been discussed on the forum.
I am using it with @reboot, I just don't know when it will run. I know it runs when the server's rebooted, but I'm still getting a 502. I haven't received any mail either.
EDIT: To see what it's saying: go here.
cloverdev You're showing us a cron job that didn't exist before the last server restart. Therefore, it couldn't have run properly for a cron task that didn't exist.
Yes, I am aware that the correct job didn't exist as it was only created yesterday. My question is how long will I have to wait for the cron job to run, or just when the server gets restarted.
The cron @reboot task launches after the server restarts, so when the hardware is reset. We do not plan to restart the server in the near future.
Is there a way to force the task to run? So that it can still be up without having the server restart?
If you want to run the task now (for testing purposes?), add a cron job to run it now at the chosen time.
If you still have questions about cron, read the official FreeBSD documentation regarding cron.
admin I do need this for production, as I'm using this to host the backend for my app. Would it eventually close if I made it run at a specific time?
cloverdev You can add a monitoring script on your end to monitor the operation of your application and start it if it's not running.
cloverdev Hello, i have the same issue with you: cron command not work after reboot. How can i receive the cron logs? Looking forward to your reply, thanks in advance.
admin I got the same issue,How can i get cron logs mail to my inbox? Looking forward to your reply, thanks in advance.
Juice168 Cron logs are accessible using the mail command. You can also redirect the output to a chosen file yourself.
admin Thank you for your reply. Can you give me a code example and when should I execute it?
Juice168 you can send the logs by setting MAILTO=inbox@example.com. If you want to redirect command output to file you can just use standard > FILE or >> FILE redirect.
MAILTO=inbox@example.com
> FILE
>> FILE
admin Ok I will try . Thank you very much 👍🙏