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/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 :-)