[CentOS] Running a command at startup
Jonathan Billings
billings at negate.org
Thu Dec 13 13:17:24 UTC 2018
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.
--
Jonathan Billings <billings at negate.org>
More information about the CentOS
mailing list