On a support forum, I was told that to turn off my board's blue led run: echo none | sudo tee /sys/class/leds/blue\:heartbeat/trigger Well, this does not survive a system reboot.? So I was told: Add the off bit to ??? /etc/rc.local Add it above "exit 0" So of course, CentOS is past using rc.local and recommends: # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this fi So can someone point me to how to make this into a simple systemd service? thanks
Does your version of CentOS have the @reboot crontab option? If it does this is probably easier unless you want to learn how to write systemd files. Leroy Tennison Network Information/Cyber Security Specialist E: leroy at datavoiceint.com 2220 Bush Dr McKinney, Texas 75070 www.datavoiceint.com TThis message has been sent on behalf of a company that is part of the Harris Operating Group of Constellation Software Inc. These companies are listed here . If you prefer not to be contacted by Harris Operating Group please notify us . This message is intended exclusively for the individual or entity to which it is addressed. This communication may contain information that is proprietary, privileged or confidential or otherwise legally exempt from disclosure. If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately by e-mail and delete all copies of the message. ________________________________________ From: CentOS <centos-bounces at centos.org> on behalf of Robert Moskowitz <rgm at htt-consult.com> Sent: Wednesday, December 12, 2018 6:04 PM To: CentOS mailing list Subject: [EXTERNAL] [CentOS] Running a command at startup On a support forum, I was told that to turn off my board's blue led run: echo none | sudo tee /sys/class/leds/blue\:heartbeat/trigger Well, this does not survive a system reboot. So I was told: Add the off bit to /etc/rc.local Add it above "exit 0" So of course, CentOS is past using rc.local and recommends: # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this fi So can someone point me to how to make this into a simple systemd service? thanks _______________________________________________ CentOS mailing list CentOS at centos.org https://lists.centos.org/mailman/listinfo/centos
On 12/12/18 7:11 PM, Leroy Tennison wrote:> Does your version of CentOS have the @reboot crontab option? If it does this is probably easier unless you want to learn how to write systemd files.CentOS 7.6.? I will have to google @reboot...> > > Leroy Tennison > Network Information/Cyber Security Specialist > E: leroy at datavoiceint.com > 2220 Bush Dr > McKinney, Texas > 75070 > www.datavoiceint.com > TThis message has been sent on behalf > of a company that is part of the Harris Operating Group of > Constellation Software Inc. These companies are listed > here > . > If you prefer not to be contacted by Harris > Operating Group > please notify us > . > This message is intended exclusively for the > individual or entity to which it is addressed. This communication > may contain information that is proprietary, privileged or > confidential or otherwise legally exempt from disclosure. If you are > not the named addressee, you are not authorized to read, print, > retain, copy or disseminate this message or any part of it. If you > have received this message in error, please notify the sender > immediately by e-mail and delete all copies of the > message. > > ________________________________________ > From: CentOS <centos-bounces at centos.org> on behalf of Robert Moskowitz <rgm at htt-consult.com> > Sent: Wednesday, December 12, 2018 6:04 PM > To: CentOS mailing list > Subject: [EXTERNAL] [CentOS] Running a command at startup > > On a support forum, I was told that to turn off my board's blue led run: > > echo none | sudo tee /sys/class/leds/blue\:heartbeat/trigger > > Well, this does not survive a system reboot. So I was told: > > Add the off bit to > > /etc/rc.local > > Add it above "exit 0" > > So of course, CentOS is past using rc.local and recommends: > > # It is highly advisable to create own systemd services or udev rules > # to run scripts during boot instead of using this fi > > So can someone point me to how to make this into a simple systemd service? > > thanks > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >
if it's Centos/RHEL 7,? you can turn it into a service that starts after boot too,? and cintrol it with systemctl. On 12/12/18 5:04 PM, Robert Moskowitz wrote:> On a support forum, I was told that to turn off my board's blue led run: > > echo none | sudo tee /sys/class/leds/blue\:heartbeat/trigger > > Well, this does not survive a system reboot.? So I was told: > > Add the off bit to > > ??? /etc/rc.local > > Add it above "exit 0" > > So of course, CentOS is past using rc.local and recommends: > > # It is highly advisable to create own systemd services or udev rules > # to run scripts during boot instead of using this fi > > So can someone point me to how to make this into a simple systemd > service? > > thanks > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos
On Wed, Dec 12, 2018 at 07:04:12PM -0500, Robert Moskowitz wrote:> > On a support forum, I was told that to turn off my board's blue led run: > > echo none | sudo tee /sys/class/leds/blue\:heartbeat/trigger > > Well, this does not survive a system reboot.? So I was told: > > Add the off bit to > > ??? /etc/rc.local > > Add it above "exit 0" > > So of course, CentOS is past using rc.local and recommends: > > # It is highly advisable to create own systemd services or udev rules > # to run scripts during boot instead of using this fi > > So can someone point me to how to make this into a simple systemd service?https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files You probably want something that is Type=oneshot. -- Jonathan Billings <billings at negate.org>
--On Wednesday, December 12, 2018 7:04 PM -0500 Robert Moskowitz <rgm at htt-consult.com> wrote:> So can someone point me to how to make this into a simple systemd service?I'd first create a utility script (untried code!) like this: /usr/local/sbin/BlueLedFunction.sh #!/bin/sh echo "$1" > /sys/class/leds/blue\:heartbeat/trigger Then I'd create /etc/systemd/system/BlueLedOff.service with appropriate sections to invoke that script with "none" as an argument and to run in your desired runlevel. (Take a look at the examples in /lib/systemd/system.) Then issue this to have it run at startup: systemctl enable BlueLedOff Note that custom unit files go in /etc/systemd/system to avoid having them overwritten by distro updates. You can customize existing unit files by either copying them from /lib/systemd to /etc/systemd or you can override single settings with specially-named subdirectories in /etc/systemd/system. See the unit file documentation for details.
Thanks, I will study this... On 12/13/18 2:38 PM, Kenneth Porter wrote:> --On Wednesday, December 12, 2018 7:04 PM -0500 Robert Moskowitz > <rgm at htt-consult.com> wrote: > >> So can someone point me to how to make this into a simple systemd >> service? > > I'd first create a utility script (untried code!) like this: > > /usr/local/sbin/BlueLedFunction.sh > > #!/bin/sh > echo "$1" > /sys/class/leds/blue\:heartbeat/trigger > > Then I'd create /etc/systemd/system/BlueLedOff.service with > appropriate sections to invoke that script with "none" as an argument > and to run in your desired runlevel. (Take a look at the examples in > /lib/systemd/system.) Then issue this to have it run at startup: > > systemctl enable BlueLedOff > > Note that custom unit files go in /etc/systemd/system to avoid having > them overwritten by distro updates. You can customize existing unit > files by either copying them from /lib/systemd to /etc/systemd or you > can override single settings with specially-named subdirectories in > /etc/systemd/system. See the unit file documentation for details. > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >