Re: Something Odd - "top" Delivers Nada When Run By Crontab
c186282 <[email protected]>
| Newsgroups | comp.os.linux.misc |
|---|---|
| Organization | wokiesux |
| Message-ID | <[email protected]> |
On 7/12/26 02:46, Lawrence D’Oliveiro wrote: > On Sat, 11 Jul 2026 05:57:16 -0000 (UTC), I wrote: > >> It needs the TERM environment variable to be defined: >> >> env -i TERM=xterm top >> >> produces a top display. > > Of course, what value such a display might have in a batch job, > remains a questionable issue ... It was reliably explained that 'top', as normally used, expects a terminal. The "-b" is by the docs the "non-interactive" mode and does not expect a terminal. Fixed MY little weirdness. Some/many CL utils work fine from a terminal or from crontab. 'Top' is not one of those. In any case, I thank those who provided the easy fix. Now my stuff works fine. Still need to clean-up the output a bit more, it's large and kinda confusing. Still better than NO output though ! Some wondered why I was using os.system() with output redirected to a file rather than 'subprocess' with it's weird lists for both input and output, sometimes 'b'inary that require translation. It's the KISS principle. Fewer, simpler, lines to save to a temp file, then open/clean that data. Sometimes "better" just ain't. Heh ... have a pgm that calls 'ffmpeg', with about 15 params. The 'subprocess' shit mostly requires composing a huge nasty list of all the params just to CALL the damned util. UGLY ! Never sure when the param and follow-on value need to be ONE item in the list or not - takes like 99 experiments. Os.system() - you simply provide a pretty standard ascii line, like you were typing from terminal, and it JUST WORKS.