Linux设置自启动命令
/etc/rc.d/init.d/
目录以自启动docker服务为例
#!/bin/bash
#add for chkconfig
#chkconfig:2345 60 20
#processname:start_run
#description:start_run
# 添加到自启动
# chmod -R 777 /etc/rc.d/init.d/start_run
# chkconfig --add start_run
# chkconfig start_run on
# 检查自启动
# chkconfig --list | grep start_run
# 返回在2345上自启动
# start_run 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# 开启运行jar
nohup java -jar /data/shell/crawler-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
# 启动docker
service docker start
sleep 5
docker start www.kecikeci.com
sleep 1
docker start v.4xx.me
#add for chkconfig
#chkconfig:2345 60 20
#processname:start_run
#description:start_run
这部分是自启脚本配置描述,必须
# chmod -R 777 /etc/rc.d/init.d/start_run
# chkconfig --add start_run
# chkconfig start_run on
执行自启命令
后边可以自定义shell内容