Forums

Claus
Claus
Offline
Resolved
0 votes
hi

How can I run a scritp on boot in ClearOS 7.2 I use to put it in rc-local but that have change
it look likes, I can't get it to Work

CB
Saturday, October 01 2016, 07:03 AM
Share this post:
Responses (2)
  • Accepted Answer

    Monday, October 03 2016, 05:11 PM - #Permalink
    Resolved
    0 votes
    I filed a bug and it is effectively a wontfix. Note the comments at the top of the 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.
    The problem is parallel execution of start up files with systemd which means that this file no longer necessarily executes at the end of startup, so, for example, it is not necessarily guaranteed that networking is up before rc.local runs. If what you are running from rc.local needs networking to be available, then it may fail. I think the recommended solution is to write your own systemd service. A PITA.
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, October 01 2016, 10:42 AM - #Permalink
    Resolved
    0 votes
    My test system is the same. It looks like a bug with an easy fix. Add execute permissions to /etc/rc.d/rc.local:
    chmod 744 /etc/rc.d/rc.local


    [edit]
    I've seen some reports that this file can fire too early under systemd, or at least earlier than other services that your program/script may depend on. In that case you may need add a delay before the line which starts your program, or write a proper systemd service file where you can add start up constraints
    [/edit]
    The reply is currently minimized Show
Your Reply