码迷,mamicode.com
首页 > 其他好文 > 详细

centos7 开机启动某些程序的方法

时间:2016-06-12 10:50:52      阅读:654      评论:0      收藏:0      [点我收藏+]

标签:

针对svn,nginx每次重启后均要手工启动,好麻烦,所以考虑将其做成开机启动,做成服务好麻烦,考虑像windows 一样,放在某个启动项中完成。

打开启动文件后,发现里面文件内容如下:

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run ‘chmod +x /etc/rc.d/rc.local‘ to ensure
# that this script will be executed during boot.

意思很简单,需要将此文件权限改为可执行的,这也是为何开机后此文件不能执行的原因

 

操作步骤:

 

1、添加可执行权限:

# chmod +x /etc/rc.d/rc.local

 

2、打开文件rc.local:

# vim /etc/rc.d/rc.local

 

3、在文件rc.local末添加开机应启动的脚本:

svnserve -d -r /var/svn
/usr/nginx/sbin/nginx

 

4、重启机器,验证svn和nginx已经启动成功

# reboot

centos7 开机启动某些程序的方法

标签:

原文地址:http://www.cnblogs.com/luhouxiang/p/5576703.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!