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

rc.local 不执行解决方法 开机启动

时间:2017-09-29 00:09:11      阅读:634      评论:0      收藏:0      [点我收藏+]

标签:rc.local   不执行   解决方法   


1,脚本环境变量的问题

2,rc.local没有可执行权限


[root@localhost ~]# cat /etc/init.d/start_svn.sh 
#!/bin/bash

SvnRepoPath=‘/home/svnrepos/‘

while [ 1 ]
do
    ps -ef > /tmp/tmp_svnserve
    cat /tmp/tmp_svnserve | grep ‘svnserve -d -r‘
    if [ $? -eq 0 ]
    then
	echo "`date ‘+%F_%H:%M:%S‘` svnsrever start OK!" > /tmp/tmp_svnserve
        exit
    else
        /usr/bin/svnserve -d -r $SvnRepoPath
	echo "`date ‘+%F_%H:%M:%S‘` svnsrever starting" > /tmp/tmp_svnserve
	
    fi
    sleep 1
done
[root@localhost ~]#
[root@localhost ~]# cat /etc/rc.d/rc.local
#!/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.

touch /var/lock/subsys/local

/bin/bash /etc/rc.d/init.d/start_svn.sh
echo "`date ‘+%F_%H:%M:%S‘` rc.local work done" >> /tmp/tmp_rc.local_log
[root@localhost ~]#



[root@localhost ~]# ll /etc/rc.d/rc.local 
-rw-r--r--. 1 root root 587 9月  28 14:11 /etc/rc.d/rc.local

[root@localhost ~]# chmod +x /etc/rc.d/rc.local

[root@localhost ~]# ll /etc/rc.d/rc.local 
-rwxr-xr-x. 1 root root 587 9月  28 14:11 /etc/rc.d/rc.local
[root@localhost ~]#





本文出自 “李春利” 博客,转载请与作者联系!

rc.local 不执行解决方法 开机启动

标签:rc.local   不执行   解决方法   

原文地址:http://990487026.blog.51cto.com/10133282/1969438

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