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 01:46, Eli the Bearded wrote:
> In comp.os.linux.misc, c186282  <[email protected]> wrote:
>> Run the script from the CL and it works perfectly.
>>
>> Run it via root crontab though and the top redirect
>> file exists, but is EMPTY.
> 
> The environment variables for cron jobs are usually nearly empty.
> Anytime something works from the shell but not from cron, check
> environment variables.
> 
> Here's a tip: your cron scripts should work with _no_ environment
> variables at all. To run them that with, use `env -i`. When I run
> `env -i top` I get _no_ output at all.
> 
> The "-b" option suggested in another post fixes the no output problem.
> 
> Elijah
> ------
> top probably wants $TERM set when not in batch mode

   As just posted ... the "-b" DID fix my weird issue.

   Kinda thought "-n" would just imply "-b" but they
   didn't write the util that way.

   Anyway, NOW I can get a better picture of why
   my unit just kinda suddenly freezes. Store
   about 250kb of logs, OUGHT to be enough to
   see if there are any services/procs/etc
   suddenly using too much CPU/mem.

   DID write a service that reports temperature and
   disk space over TCP ... looks normal until ...
   nothing useful there. Do like client/server
   stuff - that one done with very few lines
   of Python because high performance was
   not needed :-)

   DID have the damned thing auto-rebooting
   six times a day to TRY and get around this
   problem. Even that didn't always work.
   A reboot is NOT quite the same as a cold
   power-cycle restart. My unit is in a kinda
   awkward location so pulling the wall wart
   requires EFFORT and I'm getting too old
   for lots of effort :-)

   DOES give a cool IR-unfiltered wide camera
   view though. LIKE the funky colors, esp the
   ultramarine sky :-)
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.