-->

DEVOPSZONES

  • Recent blogs

    How create a service or run a script at boot time in RHEL7

    How create a service or run a script at boot time in RHEL7?

    1. [root@example.com system]# vi /etc/systemd/system/loopfscobbler.service
    2. Put this content in the file.

    [Unit]
    Description=Loop FS mount for  Cobbler
    After=network.target

    [Service]
    Type=simple
    ExecStart=/usr/local/sbin/loopfscobbler.sh
    TimeoutStartSec=0

    [Install]
    WantedBy=default.target


    3. create a script.
    [root@example.com system]# vi /usr/local/sbin/loopfscobbler.sh
    4. Make the script executable.
    [root@example.com system]# chmod +x /usr/local/sbin/loopfscobbler.sh
    5. Enable the service to start across boot.
    systemctl enable loopfscobbler.service
    6. Reboot the system to check.



    No comments