Watch output of a running cronjob process

This article is from 2015 and has been archived. It's old and probably outdated.

Sometimes you might want to hook into the output (stdout or stderr) of a running process, eg. of some periodically triggered script.

  1. Find out the process id:

    ps ax | grep ‘processname’

  2. Watch the I/O stream (replace PROCID with the process id from (1) and NUM with the desired I/O stream, where 0: stdin, 1: stdout and 2: stderr):

    tail -f /proc/PROCID/fd/NUM


Jan Beilicke

About the author

Jan Beilicke is a long-time IT professional and full-time nerd. Open source enthusiast, advocating security and privacy. Sees the cloud as other people's computers. Find him on Mastodon.