redmine centos 开机自启
时间: 2024-02-03 16:10:32 浏览: 158
centos7开机自启设置
5星 · 资源好评率100%
要在CentOS上设置Redmine开机自启动,可以按照以下步骤进行操作:
1. 创建一个Redmine启动脚本:
在`/etc/init.d/`目录下创建一个名为`redmine`的文件,可以使用以下命令创建并编辑该文件:
```
sudo vi /etc/init.d/redmine
```
2. 将以下内容复制到`redmine`文件中:
```
#!/bin/bash
#
# redmine Startup script for Redmine
#
# chkconfig: 345 99 10
# description: Redmine is a flexible project management web application.
#
# processname: redmine
# pidfile: /var/run/redmine.pid
REDMINE_HOME="/opt/redmine"
REDMINE_USER="redmine"
REDMINE_GROUP="redmine"
REDMINE_ENV="production"
start() {
echo -n "Starting Redmine: "
cd $REDMINE_HOME
su -s /bin/bash -c "RAILS_ENV=$REDMINE_ENV bundle exec rails server -d" $REDMINE_USER
echo "done."
}
stop() {
echo -n "Stopping Redmine: "
cd $REDMINE_HOME
su -s /bin/bash -c "bundle exec pumactl -P tmp/pids/server.pid stop" $REDMINE_USER
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 5
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
```
3. 保存并退出文件。
4. 授予`redmine`文件可执行权限:
```
sudo chmod +x /etc/init.d/redmine
```
5. 将Redmine添加到系统服务中:
```
sudo chkconfig --add redmine
```
6. 设置Redmine开机自启动:
```
sudo chkconfig redmine on
```
现在,当你重启CentOS服务器时,Redmine将会自动启动。
阅读全文