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@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@centos.org on behalf of Robert Moskowitz rgm@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@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@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@centos.org on behalf of Robert Moskowitz rgm@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@centos.org https://lists.centos.org/mailman/listinfo/centos _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Date: Wednesday, December 12, 2018 20:25:48 -0500 From: Robert Moskowitz rgm@htt-consult.com
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...
see: man -S5 crontab -- the "extensions" section.
On 12/12/18 9:17 PM, Richard wrote:
Date: Wednesday, December 12, 2018 20:25:48 -0500 From: Robert Moskowitz rgm@htt-consult.com
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...
see: man -S5 crontab -- the "extensions" section.
OK....
I have had problems in the past with crontab parsing a command. Would I use:
@reboot root echo none | tee /sys/class/leds/blue:heartbeat/trigger
?
Or do I have to make a script and run that?
thanks
On Wed, Dec 12, 2018 at 09:43:56PM -0500, Robert Moskowitz wrote:
OK....
I have had problems in the past with crontab parsing a command. Would I use:
@reboot root echo none | tee /sys/class/leds/blue:heartbeat/trigger
?
Or do I have to make a script and run that?
Since this is a crontab, you can use normal shell redirection:
@reboot root echo none > /sys/class/leds/blue:heartbeat/trigger
in a file in /etc/cron.d/
The 'echo foo | sudo tee' thing is what you do for people who are using sudo to echo output into a file -- so often people think they can do 'sudo echo none > /some/path' and will be surprised it doesn't work.
I still think it makes sense to create it as a systemd unit.
On 12/13/18 8:17 AM, Jonathan Billings wrote:
On Wed, Dec 12, 2018 at 09:43:56PM -0500, Robert Moskowitz wrote:
OK....
I have had problems in the past with crontab parsing a command. Would I use:
@reboot root echo none | tee /sys/class/leds/blue:heartbeat/trigger
?
Or do I have to make a script and run that?
Since this is a crontab, you can use normal shell redirection:
@reboot root echo none > /sys/class/leds/blue:heartbeat/trigger
in a file in /etc/cron.d/
The 'echo foo | sudo tee' thing is what you do for people who are using sudo to echo output into a file -- so often people think they can do 'sudo echo none > /some/path' and will be surprised it doesn't work.
Thanks. This is my first encounter with 'tee'. I guess because I rarely use sudo, and work in su if I need to do root things.
I still think it makes sense to create it as a systemd unit.
Seems the better, long-term way to go, but right now I don't have time to learn enough about making systemd unit files.
Thanks
On 12/13/18 8:17 AM, Jonathan Billings wrote:
On Wed, Dec 12, 2018 at 09:43:56PM -0500, Robert Moskowitz wrote:
OK....
I have had problems in the past with crontab parsing a command. Would I use:
@reboot root echo none | tee /sys/class/leds/blue:heartbeat/trigger
?
Or do I have to make a script and run that?
Since this is a crontab, you can use normal shell redirection:
@reboot root echo none > /sys/class/leds/blue:heartbeat/trigger
in a file in /etc/cron.d/
The 'echo foo | sudo tee' thing is what you do for people who are using sudo to echo output into a file -- so often people think they can do 'sudo echo none > /some/path' and will be surprised it doesn't work.
Thanks. This is my first encounter with 'tee'. I guess because I rarely use sudo, and work in su if I need to do root things.
I still think it makes sense to create it as a systemd unit.
Seems the better, long-term way to go, but right now I don't have time to learn enough about making systemd unit files.
But I think even the rc.local hack should work if you make it executable. At least that's what the header of rc.local says.
Regards, Simon
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@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/htm...
You probably want something that is Type=oneshot.
--On Wednesday, December 12, 2018 7:04 PM -0500 Robert Moskowitz rgm@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@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@centos.org https://lists.centos.org/mailman/listinfo/centos