fedora20发布,不对rc.local支持,其实只是删除了rc.local文件,如果想在开机时能够运行自己写的脚本,只要新建rc.local文件就可以了,下面让我们来测试下吧:
环境:fedora20 GNOME桌面
1./etc/rc.local其实是/etc/rc.d/rc.local的软连接,那么:
vi /etc/rc.d/rc.local
 #!/bin/bash
#this is a script foe nexus start,if the nexus is startting,return.
echo "nexus verify.."
testing8081=`(netstat -an|grep )`
if [ "NULL$testing8081" = "NULL" ] ; then
echo "nuxus starting..."
/home/Jorcen/Environments/nexus/nexus-2.7.-/bin/nexus start
else
echo -n "nexus had started,do you need restart it?(Y/N):"
read verify
if [ "$verify" = "Y" ] ; then
/home/Jorcen/Environments/nexus/nexus-2.7.-/bin/nexus restart
echo "nexus restared.."
fi
fi

编 辑文件/lib/systemd/system /rc-local.service,将ConditionFilel***ecutable=/etc/rc.d/rc.local前面奖赏#号注释掉 及#ConditionFilel***ecutable=/etc/rc.d/rc.local

[root@localhost Jorcen]# vi /lib/systemd/system/rc-local.service

#  This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version. # This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.d/rc.local is executable.
[Unit]
Description=/etc/rc.d/rc.local Compatibility
#ConditionFileIsExecutable=/etc/rc.d/rc.local
After=network.target [Service]
Type=forking
ExecStart=/etc/rc.d/rc.local start
TimeoutSec=
RemainAfterExit=yes
SysVStartPriority=

step2

 [root@localhost Jorcen]# chmod +x /etc/rc.d/rc.local
[root@localhost Jorcen]# ln -s /etc/rc.d/rc.local /etc/rc.local
[root@localhost Jorcen]# systemctl status rc-local.service
rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
Active: failed (Result: exit-code) since Sat -- :: CST; 2min 44s ago
Process: ExecStart=/etc/rc.d/rc.local start (code=exited, status=/EXEC) Mar :: localhost.localdomain systemd[]: Starting /etc/rc.d/rc.local...
Mar :: localhost.localdomain systemd[]: rc-local.service: control p...
Mar :: localhost.localdomain systemd[]: Failed to start /etc/rc.d/r...
Mar :: localhost.localdomain systemd[]: Unit rc-local.service enter...
[root@localhost Jorcen]# systemctl start rc-local.service
[root@localhost Jorcen]# systemctl status rc-local.service
rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
Active: active (running) since Sat -- :: CST; 27s ago
Process: ExecStart=/etc/rc.d/rc.local start (code=exited, status=/SUCCESS)
Main PID: (wrapper)
CGroup: name=systemd:/system/rc-local.service
├─ /home/Jorcen/Environments/nexus/nexus-2.7.-/bin/jsw/linux-x86-/wrapper /home/Jorcen/Environments/nexus/nexus-2.7.-/bin/js...
└─ java -Djava.net.preferIPv4Stack=true -Dcom.sun.jndi.ldap.connect.pool.protocol=plain ssl -Djava.library.path=bin/jsw/lib -classpa... Mar :: localhost.localdomain systemd[]: Starting /etc/rc.d/rc.local Compatibility...
Mar :: localhost.localdomain rc.local[]: nexus verify..
Mar :: localhost.localdomain rc.local[]: nuxus starting...
Mar :: localhost.localdomain rc.local[]: ****************************************
Mar :: localhost.localdomain rc.local[]: WARNING - NOT RECOMMENDED TO RUN AS ROOT
Mar :: localhost.localdomain rc.local[]: ****************************************
Mar :: localhost.localdomain rc.local[]: Starting Nexus OSS...
Mar :: localhost.localdomain rc.local[]: Removed stale pid file: /home/Jorcen/Environments/nexus/nexus-2.7.-/nexus.pid
Mar :: localhost.localdomain systemd[]: Started /etc/rc.d/rc.local Compatibility.
chmod +x /etc/rc.d/rc.local
ln -s /etc/rc.d/rc.local /etc/rc.local
2.查看rc-local.service
systemctl status rc-local.service
如果服务没有启动可以先启动下rc-local.service
3.启动rc-local.service
systemctl start rc-local.service
然后用第2点的命令查看服务状态,这里可能有的服务启动不起来,为什么:
解决:
编辑文件/lib/systemd/system /rc-local.service,将ConditionFilel***ecutable=/etc/rc.d/rc.local前面奖赏#号注释掉 及#ConditionFilel***ecutable=/etc/rc.d/rc.local
再次启动下rc-local.service并用systemctl status rc-local.service看看状态是不是已经启动起来了
4.重启机器
查看/root下是不是多了个文件test,说明我们的开机脚本已经运行了!
 
 

linux_fedora nexus_auto_start的更多相关文章

随机推荐

  1. Linux下用freetds连接mssql中文乱码的问题【参考1】

    由于工作原因我们需要通过php访问我们以前的Sql Server 2005数据,所以就有了这篇文章的诞生.废话就少说了,做程序设计的最不喜欢兜圈子了.用简介步骤说明问题,往下看.系统:   Linux ...

  2. 20150222—LINQ to SQL 插入、更新和删除

    注意,使用LINQ to SQL时, 表中必须有一个主键才可以起效,否则系统将无法对数据作出修改 插入新数据,根据上一片的文章实例在其中添加新的控件: 编号TextBox(Name):sno 名字Te ...

  3. (转)Linux概念架构的理解

    英文原文:Conceptual Architecture of the Linux Kernel 摘要 Linux kernel成功的两个原因:(1)架构设计支持大量的志愿开发者加入到开发过程中:(2 ...

  4. 10款基于jquery的web前端特效及源码下载

    1.jQuery时间轴插件:jQuery Timelinr 这是一款可用于展示历史和计划的时间轴插件,尤其比较适合一些网站展示发展历程.大事件等场景.该插件基于jQuery,可以滑动切换.水平和垂直滚 ...

  5. 《锋利的jQuery》心得笔记--Three Sections

    第六章 1.    JavaScript的Ajax的实现步骤: 1)         定义一个函数用来异步获取信息 function Ajax(){ } 2)         声明: var xmlH ...

  6. Fedora 19 配置参考

    1. 安装完Fedora 19之后,第一件事不是升级系统,而是添加源. 下载我配置好的源,非常全面,适用Fedora 19 x86_64.点我下载 打开终端,切换到repo.zip所在目录:mv re ...

  7. ADO.NET笔记——使用DataSet返回数据

    相关知识: DataSet和DataAdapter的内部结构: DataSet通过DataAdapter从数据库中获取数据 DataSet对象内部包括一个集合(Tables),也就是可以拥有多个表(D ...

  8. 在 linux x86-32 模式下分析内存映射流程

    前言 虚拟内存机制已经成为了现代操作系统所不可缺少的一部分, 不仅可以为每个程序提供独立的地址空间保证安全性,更可以通过和磁盘的内存交换来提高内存的使用效率.虚拟内存管理作为linux 上的重要组成部 ...

  9. iOS相机操作笔记

    最近忙于项目,需要拍摄图片,这里先列出部分测试代码. // // FirstViewController.m // UiTest // // Created by Tang Huaming on 16 ...

  10. HTML5-Geolocation&地图.html

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...