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?

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .