在linux环境下使用命令行控制redmine各项服务

最近有学员问:在windows环境下或者linux图形界面时,redmine各项服务可以通过操作图形界面操控,如下图所示。但是当在linux纯命令行界面时,该如何操作来控制redmine各项服务呢?


在linux环境下使用命令行控制redmine各项服务

在linux环境下使用命令行控制redmine各项服务



解决方案:

步骤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的服务状态操作类似,不在赘述,同学们自行实验即可。




本文转自 昊洋教育 51CTO博客,原文链接:http://blog.51cto.com/zdytesting/1896404,如需转载请自行联系原作者

上一篇:ECS使用体验


下一篇:ftp传输文件—从windows向ubuntu传送文件