Thanks, this all sounds like it'll be a very good idea. syslog is attractive, but I'm not sure this even has syslog. Or maybe I need to turn it on, I remember hearing something about it anyway. I'll figure it out and get back to you.
At the moment I'm adding indexes to the database so it'll have to be a bit later on - this looks like it will take a few hours. Hamish On 18/02/2021 16:20, Keith Edmunds wrote: > OK, this is what I would do. Check whether logger (typically > /usr/bin/loggger) is installed on the system. If it is, create a script > that runs at boot as follows: > > #!/bin/ash [if /bin/bash is available, I'd use that] > > /usr/bin/logger -t xyzzy "SHELL=$SHELL" > /usr/bin/logger -t xyzzy "me=$(whoami)" > echo "test" > /tmp/me.log > /usr/bin/logger -t xyzzy "Status after file write: $?" > > What that does: > > - /usr/bin/logger makes entries in syslog, so no need to worry about > writing files > > - "-t xyzzy" will tag each syslog entry with "xyzzy". Of course you can > use any string, but that allows you to 'grep xyzzy /var/log/messages' > (or wherever syslog writes) > > - we check the shell (is it really ash?) > > - we check who we are (are we really root?) > > - we try writing to a file and report the status of doing so > > Just looking at your original post, the other thing I'd change is the > relative file reference. Rather than writing to ../stdout.log, just write > to /tmp/stdout.log. Better still: > > python3 ./main.py --id "NAS" 2>&1 | tee /usr/bin/logger -t xyzzy > > ...and have it sent to syslog. > > hth
signature.asc
Description: OpenPGP digital signature
-- Next meeting: Online, Jitsi, Tuesday, 2021-03-02 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk