With FreeBSD you can have /proc mounted by putting the following line in /etc/fstabtrying to see what is going to stdout of a running python process.
Whats command or package is the best way to do this?
I did see a stack overflow post saying do x but cannot find it again.
Any help or ideas appreaciated.
proc /proc procfs rw 0 0
% strace
strace: Command not found.
% pkg info --list linux-c7-strace | grep bin/
/compat/linux/usr/bin/strace
/compat/linux/usr/bin/strace-log-merge
%
Look in the mail of the user that ran that cron. Any output of a cron job is mailed to the user that ran it.to get the stdout of in this case a python script running via cron
0 * * * * mycommand > /var/log/mycommand.log
Is the output redirected to /dev/null perhaps? Then just redirect it to a log file instead.
It depends on how things are set up. For debugging purposes just redirect it to a file. Then you'll know what it does. Once you figure out what's wrong with it and fixed it you can redirect it back to /dev/null again.I dont really want to manage a log file for this script.
>
instead of >>
, the first will create a new file with every run, the second will append to the log file (which could then grow unintentionally large, but you could manage that with newsyslog(8) for example).That why you should first make sure the script itself doesn't output anything unless there is a problem. Problems should be printed to stderr.but it really doesn't need to be outputting all that junk unless there is a problem.
The hardware it runs on is irrelevant. It's a cronjob running on FreeBSD. That works the same on any version and any architecture.it seems it is much more difficult than on the pi.
I have also usedthanks will take a look, ive used log rotate for this before but it really doesn't need to be outputting all that junk unless there is a problem.
The > might work however this is a 1 minute cron that fires up checks for a pidlock for its own process then either exits or does what it is meant to do depending on some other factors so im not sure I would see the file before its overwritten which is why im trying to see what the last x lines of stdout were for that process. it seems it is much more difficult than on the pi.
| logger
in crontab. See logger(1). That will write the output to system log. Usually logs are rotated anyway.