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/13/26 05:01, The Natural Philosopher wrote: > On 13/07/2026 00:25, c186282 wrote: >> On 7/11/26 23:36, Rich wrote: >>> c186282 <[email protected]> wrote: >>>> On 7/11/26 02:40, rbowman wrote: >>>>> On Fri, 10 Jul 2026 23:57:54 -0400, c186282 wrote: >>>>> >>>>>> Wrote a short Python script that uses os.system() to run 'top' ... >>>>>> redirecting the output to a file. We then clean-up the weird chars in >>>>>> the file and append it to an ongoing log file. >>>>> >>>>> I think we've been here before... >>>>> >>>>> https://docs.python.org/3/library/subprocess.html >>>>> >>>>> Yes, it's one of those hateful, newfangled functions that might >>>>> work for >>>>> you. >>>> >>>> Um ... there are LOTS of 'monitoring' apps for Linux >>>> at this point - just did a survey a couple of days >>>> ago. Most are serious OVER-kill. They also tend to >>>> record SO much shit that you'll never be able to find >>>> YOUR particular problem in the mess. >>>> >>>> Anyway, the "-b" param to 'top' did do the trick. >>>> Still not sure why evoking from the CL is so different >>>> from evoking via crontab - but that's how it is. >>> >>> Because without -b, top expects to be connected to a tty. And when >>> running from a crontab, there is no tty. With no tty, top didn't >>> bother doing anything but exiting. >>> >>> This is basic Unix 101 level stuff. >> >> Some were late to class that day :-) >> >> > More relevantly, > - no one knows all of Unix/Linux Very true at this point ! People COULD know CP/M and DOS ... but we've gone WAY beyond that level. Anyway, I understand the issue with 'top' ... in typical evocation it's kinda interactive and thus expects a terminal. Some other basic utils will be similar, others not. 'df' is 'df'. I kinda like doing os.system() evocations of those good old utils and then parsing the output. The older the util, the more stable the output format. And, well, why re-invent the wheel ? > - some peoples experience goes very deep is some areas > - conversely those areas having been been completely irrelevant and > never explored is someone else's life experience. > > For example, I never had any need whatsoever to type 'emacs' on a > command line > Other peoples days (if their session was not still active) did that as > the first thing in the morning. > > It being some primitive approximation to a multi tasking windows session. These forums exist because there are enough people, each with their particular areas of expertise and experience, that can chime in. The "-b" info was "good enough", but *explained* made that even better. And when there aren't really any odd issues - POLITICS ! :-) And, ouch !, got bit by my IBM stock today ! Everyone's money is in 'chips/mem' right now and IBM is more 'software/systems'. Alas seems everybody is making 'the perfect chip' at the moment ... but tomorrow someone will make a BETTER one and the prev corp will go down the drain. A very volatile investment environment - TOO volatile. BUT ... chips are just ceramic squares. Gotta have systems/software to make 'em BE anything. So IBM and friends WILL shortly rise again. Buy low. What did The Book say ... "DON'T PANIC !" :-)