ViReR.NeT  

  Home  -  Infos/Docs  -  Tools/Outils Code  -  Links/Liens  -  News  -  Download  -  Others/Autres Site map

How to create your stratup script on RHEL 7 or CentOS 7





1) first create a systemd unit file like this:

  /usr/lib/systemd/system/my-startup-script.service

2) inside that file add something like this:

[Service]
ExecStart=/opt/my-startup-script.sh
Restart=no
Type=oneshot
User=root
Group=root
Environment=PATH=/bin:/sbin:/usr/bin:/usr/sbin

[Install]
WantedBy=multi-user.target


3) Then, as root, enable that service:
systemctl enable my-startup-script.service