linux设置nexus开机自启动_linux设置开机启动

一、rc.local自启动和profile.d/file的区别

linux启动顺序:

1、通过/boot/vm进行启动 vmlinuz

2、init /etc/inittab

3、启动相应的脚本,并且打开终端

①rc.sysinit

②rc.d

③rc.local(这里...)

4、启动login登录界面 login

5、在用户登录的时候执行sh脚本的顺序,每次登录的时候都会完全执行

①/etc/profile.d/file(这里...)

②/etc/profile

③/etc/bashrc

④/root/.bashrc

⑤/root/.bash_profile

原文链接:https://blog.csdn.net/pingnanlee/java/article/details/44785715

综上,区别是:

①rc.local 是真正的开机启动,在开机时以root权限启动一次。

②而 profile.d/file 是用户在登录(界面登录、xshell远程登录。。。)时会执行一次,即每执行一次登录,都会启动一次。这不是开机启动,是登录启动。

二、开机启动设置

1、rc.local开机启动

sudo vim /etc/rc.local

执行多条开机启动语句,每条语句前面加 nohup ,后面加 & 。

#!/bin/sh -e

#

# rc.local

#

# This script is executed at the end of each multiuser runlevel.

# Make sure that the script will "exit 0" on success or any other

# value on error.

#

# In order to enable or disable this script just change the execution

# bits.

#

# By default this script does nothing.

#sh /home/tgj/桌面/start.sh

nohup sudo /opt/nexus-3.6.0-02/bin/nexus start &

nohup sudo pgyvpn &

nohup svnserve -d -r /opt/svn &

exit 0

2、profile.d/file登录启动

touch /etc/profile.d/svnserve.sh

vim /etc/profile.d/svnserve.sh

#文件中输入:

svnserve -d -r /opt/svn

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值