您在這裡

[已解決]請問Drush安裝和使用問題

fuchen's 的頭像
fuchen 在 2013-05-09 (四) 11:54 發表

各位drupal前輩你好,我最近想嘗試用Drush做cron的執行,
因為從來沒安裝過Drush,所以在安裝後發生了無法執行drush cron的問題。
想請教各位前輩,問題發生在哪?

一開始我將drush解壓放到/etc/下
然後執行下列指令

> ln -s /etc/drush/drush /usr/bin/drush
> export PATH="$PATH:/etc/drush:/usr/bin/drush"

剩下在說明檔所說的安裝選項都沒有做
6. Optional. See examples/example.bashrc for instructions on how to add some...
7. Optional. If you didn't source it in Step 6 above, see top of...
8. Optional. If drush.complete.sh is being sourced (ideally in...

接者測試

> drush cron
Command core-cron needs a higher bootstrap level to run - you will [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'cron' could not be executed. [error]
A Drupal installation directory could not be found [error]
> drush cc
Enter a number to choose which cache to clear.
[0] : Cancel
[1] : drush

Cancelled
> drush status
PHP configuration : /etc/php.ini
Drush version : 5.9
Drush configuration :

後來發現應該是沒路徑,加上測試
> drush status -u 1 -r /var/www/lifexup6dk4 -l http://192.168.1.88
Drupal version : 7.21
Site URI : http://192.168.1.88
Database driver : mysql
Database hostname : localhost
Database username : fuchen
Database name : fuchen
Database : Connected
Drupal bootstrap : Successful
Drupal user : fuchen
Default theme : bartik
Administration theme : seven
PHP configuration : /etc/php.ini
Drush version : 5.9
Drush configuration :
Drupal root : /var/www/lifexup6dk4
Site path : sites/default
File directory path : sites/default/files
Private file directory path : sites/default/files/private
Temporary file directory path : /tmp
> drush cc all -u 1 -r /var/www/lifexup6dk4 -l http://192.168.1.88
'all' cache was cleared in /var/www/lifexup6dk4#192.168.1.88 [success]
> drush cron -u 1 -r /var/www/lifexup6dk4 -l http://192.168.1.88
Drush command terminated abnormally due to an unrecoverable error. [error]

下面是用-d(Debug)顯示的訊息
> drush -v -d cron -u 1 -r /var/www/lifexup6dk4 -l http://192.168.1.88
Bootstrap to phase 0. [0 sec, 2.14 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.26 MB] [bootstrap]
Cache HIT cid: 5.9-commandfiles-0-8e5ccbc9ea181e2d3e17e80fb4ac12ef [debug]
[0.01 sec, 2.27 MB]
Bootstrap to phase 0. [0.04 sec, 4.8 MB] [bootstrap]
Bootstrap to phase 6. [0.05 sec, 4.8 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.05 sec, 4.8[bootstrap]
MB]
Initialized Drupal 7.21 root directory at /var/www/lifexup6dk4 [0.06 [notice]
sec, 5.72 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.06 sec, [bootstrap]
5.72 MB]
Initialized Drupal site 192.168.1.88 at sites/default [0.06 sec, 5.72 [notice]
MB]
Cache HIT cid: 5.9-commandfiles-2-c32acd775c18a90c5b41d0fc9accf5ab [debug]
[0.06 sec, 5.73 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.06[bootstrap]
sec, 5.73 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.06 sec,[bootstrap]
5.73 MB]
Successfully connected to the Drupal database. [0.06 sec, 5.73 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.07 sec, [bootstrap]
6.17 MB]
Cache HIT cid: 5.9-commandfiles-5-3825c5a5734ed57c3812c90883ab9b3a [debug]
[0.33 sec, 31.9 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_login() [0.34 sec, [bootstrap]
32.32 MB]
Successfully logged into Drupal as fuchen (uid=1) [0.34 sec, 32.35 [bootstrap]
MB]
Found command: core-cron (commandfile=core) [0.34 sec, 32.35 MB] [bootstrap]
Drush command terminated abnormally due to an unrecoverable error. [error]
[0.52 sec, 32.66 MB]

> drush test-run -u 1 -r /var/www/lifexup6dk4 -l http://192.168.1.88
Command test-run needs the following modules installed/enabled to [error]
run: simpletest.
The drush command 'test-run' could not be executed.

請問還需要什麼步驟才能執行cron?

參照http://drupal.org/node/1526174
elysia-cron模組會造成cron無法執行,關掉就沒事了。