[英]Is it possible to change working directory and run php artisan command
我已經設置了一個 cron 作業來執行 hello.sh
如果我使用 echo $PWD 從腳本中回顯當前目錄 output /home/u341967117
echo $PWD
#output /home/u341967117
#and I can not run artisan command here since the Laravel installation for is /home/u341967117/domains/unieschools.com/public_html/ngit
所以我嘗試在運行 php artisan 命令之前更改目錄
\#!/bin/bash
cd /domains/unieschools.com/public_html/ngit
echo $PWD
#php artisan command comes here
但是執行腳本的 cron 作業的 output 拋出錯誤No such file or directory
我嘗試將工作目錄更改為指向 laravel 項目文件夾,但它不斷拋出錯誤,指出不存在這樣的目錄
你可以在你的文件中使用它:
PHP=`which php`
$PHP artisan optimize:clear
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.