0

I have a program, say

#!/bin/bash
while ( true ){
    echo 'hello'
    sleep 10
}

Which is started from the crontab like so

0 0 1 1 *

I can list this running process using a command like

ps aux | grep print.sh

Is there a way I can view the stdout of this script after it's been started from the crontab?

0

You can redirect the output to a file and then read it with tail.

#!/bin/bash
while ( true ){
    echo 'hello' >> $HOME/tmp/log
    sleep 10
}

Now you can view the output with tail.

tail -f $HOME/tmp/log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.