It is necessary to add to cron a task that will execute a script containing a large number of outputs in stdout. In this case, you need to implement two such things:

  1. Conclusions in the stdout script must be written to the file (including the error with which the script falls out). At the same time, this log file must be cleaned each time before performing the task. Those. contain only the log of the last completed task.
  2. It should be possible to see the current output in stdout of the currently executing task. Of course, there can be several tasks at once. And they all run on a remote server. And now you need to be able to connect to the server, see what tasks are being performed at the moment. And right in the live mode, I want to see the current stdout of the currently running task.
  • 2
    To add a crown to the command at the end> ​​/var/log/tut_imya_loga.log 2> & 1 and watch it through tail -f is not an option? - nobody
  • @nobody seems to tail what you need. Thank. > /var/log/tut_imya_loga.log 2>&1 will rewrite the file each time or write to the end? - leaf
  • I don’t understand one thing - and why it’s impossible to use normal output in syslog in these tasks? Then all the problems would be solved immediately. Or are the task source texts missing? In the version that suggested by nobody , if several tasks are running, they will erase the output of each other. - Sergey
  • @Sergey can and can) Just not very quick in linux, so I ask. Thanks for the thought, I study the topic. - leaf
  • one
    Does the @leaf idea with syslog suggest replacing all echo with syslog ()? quite right. Can you even try to pretend and write a macro :-) viewed in "live mode"? The same tail? - of course. Personally, when debugging, I do this: tail -f / var / log / messages | grep svl & Attention: svl is the identifier that I specified in openlog () . Ampersend at the end of the command line takes this command to the background and I can continue to work in the terminal in any way. And the messages that interest me will be displayed on the terminal only when they appear real. - Sergey

0