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:00, rbowman wrote:
> On Sat, 11 Jul 2026 22:54:10 -0400, c186282 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.
> 
> subprocess is not an app. It is the Python library that is recommended
> rather than the older os.system and has more flexibility but you got
> system to work so go in peace. It probably won't be deprecated and dropped
> any time soon.

   I've used subprocess quite a bit. It is theoretically
   'more capable' but can be far more complicated than
   needed. 'os.system()' is my pref wherever possible.
   If I need output from some call then subprocess will
   deliver that. In this particular case I just had the
   util dump to a temporary file. Just a few lines to
   open/read/clean the contents. No real advantage in
   using subprocess, so I didn't. KISS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.