Re: Running a command at startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxxxxxxxx> 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@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux