编辑rc.local文件

vi /etc/rc.d/rc.local

例如

 #!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff. touch /var/lock/subsys/local
/opt/redis/src/./redis-server /opt/redis/redis.conf memcached -d -u root -P /tmp/memcached.pid -m 128m /opt/activemq/bin/./activemq start /opt/tomcat/bin/./startup.sh /usr/local/nginx/sbin/./nginx /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &

赋予权限

chmod 771 /etc/rc.d/rc.local

若是开机不执行

/usr/bin/rsync --daemon

echo "/usr/bin/rsync --daemon" >> /etc/rc.local

ls -al /etc/rc5.d/S99local 看下S99local究竟指向的是 /etc/rc.local 还是 /etc/rc.d/rc.local
如果是/etc/rc.d/rc.local,就自己 ln -sf /etc/rc.d/rc.local /etc/rc.local

cd /etc/init.d

»service rc.local start
hello world
»initctl start rc.local
initctl: Unknown job: rc.local
»initctl list | grep rc
rc stop/waiting
rcS stop/waiting
rc-sysinit stop/waiting

CentOS新增开机启动项的更多相关文章

  1. Centos下安装最新版Mono并为windwos服务配置开机启动项

    一:安装Mono,此步骤参照官网 1:配置Yum仓库 #Centos 7yum install yum-utils rpm --import "http://keyserver.ubuntu ...

  2. Centos 配置开机启动脚本启动 docker 容器

    Centos 配置开机启动脚本启动 docker 容器 Intro 我们的 Centos 服务器上部署了好多个 docker 容器,因故重启的时候就会导致还得手动去手动重启这些 docker 容器,为 ...

  3. centos7下/etc/rc.local文件里配置的开机启动项不执行的解决办法

    习惯于在/etc/rc.local文件里配置我们需要开机启动的服务,这个在centos6系统下是正常生效的.但是到了centos7系统下,发现/etc/rc.local文件里的开机启动项不执行了!仔细 ...

  4. CentOS7 添加开机启动项

     centos6 加入开机启动:   vim /etc/rc.d/rc.local 注意命令不要出错,重启后生效   或者   centos 7 下: vim /lib/systemd/system/ ...

  5. Redis加入Centos Linux开机启动

    Redis加入Centos Linux开机启动 网上有很多redis在linux下自动启动的例子,实现的方式很多,很多都是参考一个老外流传出来启动的例子,其实直接使用是不行,而且有很多地方有一些语法错 ...

  6. [ubuntu][deepin]系统增加自定义开机启动项

    [ubuntu][deepin]系统增加自定义开机启动项 进行配置 cd /etc/init.d/ ls vim myScript nginx实例 #! /bin/sh # chkconfig: # ...

  7. (转)CentOS下开机启动查看管理命令:chkconfig用法

    CentOS下开机启动查看管理命令:chkconfig用法   CentOS下开机启动查看管理的命令是:chkconfig   1. 开机启动列表查看: chkconfig --list     说明 ...

  8. PowerShell添加或修改注册表开机启动项脚本

    代码如下: $name = Read-Host "请输入开机启动项的名字(随便起)" $value = Read-Host "请输入开机启动项的值" try{ ...

  9. gnome3.X添加开机启动项

    背景:升级gnome后发现gnome-session-properties不见了,想把sslocal随机启动遇到了麻烦... 特别说明:此为图形桌面开机启动项,因此只有通过图形桌面登陆用户后才能启动. ...

随机推荐

  1. hdu_1403_Longest Common Substring(后缀数组的应用)

    题目链接:hdu_1403_Longest Common Substring 题意: 给你两个字符串,然你找最长的公共子串 题解: 后缀数组的经典应用,要找两个字符串的公共子串,那么就相当于找两个串的 ...

  2. 开始工作----微信通过get检查当前网站---是否可用

    01开发者--基本配置--url服务器地址---填写好--需要开通微信接口的域名 http://www.cctv.com/xxx.php文件 xxx.php文件 01参考wx_sample.php 0 ...

  3. shell脚本中$

    变量名只能包含数字.字母和下划线,因为某些包含其他字符的变量有特殊含义,这样的变量被称为特殊变量. 例如,$ 表示当前Shell进程的ID,即pid ./package/kernel/mac80211 ...

  4. MQL5 获取最后一单 利润

    ///x 最后几单 double getLastProfit(int x) { HistorySelect(,TimeCurrent()); double profit ; long ticket ; ...

  5. split a string in C++

    This is my favourite way to iterate through a string. You can do what you want per word. string line ...

  6. javascript 浏览器

    hashchange事件 window.location.hash.slice(1) 添加和修改历史记录条目LINKHTML5引进了history.pushState()方法和history.repl ...

  7. PHP字符串函数试题

    Ctrl+A查看答案 1.把ASCII字符的字符串转换为十六进制值的函数是什么?答:bin2hex($string),例如bin2hex('ab') = 6162 2.ASCII码转字符,字符转ASC ...

  8. textFiled输入字数的控制问题之—把带输入的拼音也判断了

    一个textFiled,控制只能输入五个字,现在你已经输入了四个字,在输入第五个字的时候,输入一个拼音之后就不能输入后一个拼音,这里把拼音也当成字来判断了,这种情况下就需要_textFiled.mar ...

  9. SQL 列拆分

    with CTE as( SELECT A.id, B.value FROM( SELECT id, value = CONVERT(xml,'<root><v>' + REP ...

  10. postfix防垃圾邮件

    Postfix 2.x 打开/etc/postfix/main.cf文件,在其中增加如下的几行(如果相关的配置存在,就替换之): vi /etc/postfix/main.cf [...] smtpd ...