Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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