在linux環境下使用命令行控制redmine各項服務

最近有學員問:在windows環境下或者linux圖形界面時,redmine各項服務可以通過操作圖形界面操控,如下圖所示。但是當在linux純命令行界面時,該如何操作來控制redmine各項服務呢?


wKiom1icHO6zEmcnAAA_W_UkorY017.png-wh_50

wKioL1icHO6BcYgQAACmgIatM3U637.png-wh_50



解決方案:

步驟1:打開linux下的命令行窗口,進入redmine的安裝目錄文件夾,發現文件“ctlscript.sh”,運行./ctlscript.sh,出現如下提示:


[root@localhost opt]# cd redmine-3.0.3-0/

[root@localhost redmine-3.0.3-0]# ls

apache2        ctlscript.sh       mysql           README.txt  uninstall

apps           git                perl            ruby        uninstall.dat

changelog.txt  img                php             scripts     use_redmine

common         licenses           postgresql      sqlite

config         manager-linux.run  properties.ini  subversion


[root@localhost redmine-3.0.3-0]# ./ctlscript.sh 

usage: ./ctlscript.sh help

       ./ctlscript.sh (start|stop|restart|status)

       ./ctlscript.sh (start|stop|restart|status) mysql

       ./ctlscript.sh (start|stop|restart|status) apache

       ./ctlscript.sh (start|stop|restart|status) subversion


help       - this screen

start      - start the service(s)

stop       - stop  the service(s)

restart    - restart or start the service(s)

status     - show the status of the service(s)


步驟2:如果是設置所有的服務,直接操作./ctlscript.sh + start/stop/restart/status就可以了,如下所示:


[root@localhost redmine-3.0.3-0]# ./ctlscript.sh status

subversion already running

apache already running

mysql already running


[root@localhost redmine-3.0.3-0]# ./ctlscript.sh restart

/opt/redmine-3.0.3-0/subversion/scripts/ctl.sh : subversion stopped

Syntax OK

/opt/redmine-3.0.3-0/apache2/scripts/ctl.sh : httpd stopped

/opt/redmine-3.0.3-0/mysql/scripts/ctl.sh : mysql stopped

170209 15:23:53 mysqld_safe Logging to '/opt/redmine-3.0.3-0/mysql/data/mysqld.log'.

170209 15:23:53 mysqld_safe Starting mysqld.bin daemon with databases from /opt/redmine-3.0.3-0/mysql/data

/opt/redmine-3.0.3-0/mysql/scripts/ctl.sh : mysql  started at port 3306

Syntax OK

/opt/redmine-3.0.3-0/apache2/scripts/ctl.sh : httpd started at port 80

/opt/redmine-3.0.3-0/subversion/scripts/ctl.sh : subversion started at port 3690


步驟3:如果是設置單獨的服務,直接操作./ctlscript.sh + start/stop/restart/status + apache/mysql/subversion就可以了,例如apache服務的關閉、狀態查詢和開啓,如下所示:



[root@localhost redmine-3.0.3-0]# ./ctlscript.sh stop apache

Syntax OK

/opt/redmine-3.0.3-0/apache2/scripts/ctl.sh : httpd stopped

[root@localhost redmine-3.0.3-0]# ./ctlscript.sh status apache

apache not running

[root@localhost redmine-3.0.3-0]# ./ctlscript.sh start apache

Syntax OK

/opt/redmine-3.0.3-0/apache2/scripts/ctl.sh : httpd started at port 80


mysql和subversion的服務狀態操作類似,不在贅述,同學們自行實驗即可。


Redmine項目管理平臺之實戰視頻課程(新增第5章應用技術更新)

http://edu.51cto.com/course/course_id-3686.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章