On 12/12/18 9:17 PM, Richard wrote:> >> Date: Wednesday, December 12, 2018 20:25:48 -0500 >> From: Robert Moskowitz <rgm at 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. -- Jonathan Billings <billings at negate.org>
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