Centos 7 添加開機啓動

一、添加啓動服務

添加docker開機啓動服務docker

[root@localhost ~]# systemctl enable docker.service
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.bash

二、添加啓動腳本

一、編寫腳本this

[root@localhost ~]# vi ping_route_donot_del.sh
ping 10.47.85.129 &
[root@localhost ~]# chomd +x ping_route_donot_del.shspa

二、添加開機啓動ip

[root@localhost ~]# vi /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
/root/ping_route_donot_del.shget

三、賦予開機啓動權限it

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

相關文章
相關標籤/搜索