Skip to main content
use code escapes
Source Link
HalosGhost
  • 4.9k
  • 10
  • 37
  • 42

Another option, which I find easier, is to run the script with cron and tell bash to login (hence using /etc/profile.d/.../etc/profile.d/... environment definitions)

In crontab -ecrontab -e file:

*/1 * * * * bash -l -c './cron_job.sh' */1 * * * * bash -l -c 'php -f ./cron_job.php' 

Any command after the source of .bash_profile.bash_profile will have your environment as if you logged in.

Another option, which I find easier, is to run the script with cron and tell bash to login (hence using /etc/profile.d/... environment definitions)

In crontab -e file:

*/1 * * * * bash -l -c './cron_job.sh' */1 * * * * bash -l -c 'php -f ./cron_job.php' 

Any command after the source of .bash_profile will have your environment as if you logged in.

Another option, which I find easier, is to run the script with cron and tell bash to login (hence using /etc/profile.d/... environment definitions)

In crontab -e file:

*/1 * * * * bash -l -c './cron_job.sh' */1 * * * * bash -l -c 'php -f ./cron_job.php' 

Any command after the source of .bash_profile will have your environment as if you logged in.

Source Link
Artistan
  • 463
  • 5
  • 6

Another option, which I find easier, is to run the script with cron and tell bash to login (hence using /etc/profile.d/... environment definitions)

In crontab -e file:

*/1 * * * * bash -l -c './cron_job.sh' */1 * * * * bash -l -c 'php -f ./cron_job.php' 

Any command after the source of .bash_profile will have your environment as if you logged in.