Pass variabel in cron job command

PeterVeldhuis

Verified User
Joined
Jan 18, 2024
Messages
33
Location
Apeldoorn
I've succesfully setup a cron job with a php-script.

In my previous envrionment I could pass a variable in the command (containing value about domain and variable so I don't need to customize the script over diffrent domains en envrionments. Is that also possible within DA?

php /home/ilonasuat/domains/uat.[domain]/backgroundjobs/Script.php

The variable I would like to add is "Environment".

Appriciate any recommendantions.
 
Normally yes.
For this forum software DA is using, there is also a cronjob like this:
Code:
* * * * * php -d memory_limit=-1 -d max_execution_time=0 /home/user/domains/userdomain.com/public_html/cmd.php xf:run-jobs >/dev/null 2>&1

As you can see behind the cmd.php at the end, also a variable is placed. So should not be an issue.
Just be aware that if you use it like this, the default php version of the system (DA) is used, being php1 in options.conf.

If you need another php version to be used, you have to specify it, for example like this:
Code:
* * * * * /usr/local/php82/bin/php etc.
 
Back
Top