1

I have a task setup to run on my cronjob where I need to read the output. What I need from the output is the starting character (let's say A) and the ending character (let's say Z).

A helps me understand my script started from the right place, and Z helps me understand my script finished at the right place.

So, it is important for me to run that cronjob, and see that my output is having proper A and Z.

I know that not sending the script to > /dev/null will try to mail using the MTA, which is not something I want to do. I also don't want to send it to /dev/null because I need to read the output.

When I run my script normally from the console (tty), I am able to see the start character (A) and end character (Z), but when I let the cronjob run, my script fails to read the start character and complains about no start characters.

What can be the problem?

Thank you.

3
  • try this useful link. You could redirect standard output and standard errors using > /path/to/out/file 2>&1 instead of > /dev/null
    – Lety
    Oct 23, 2014 at 23:16
  • Is this a dupe, or did you want it in a file instead of on the terminal emulator?
    – Sparhawk
    Oct 24, 2014 at 3:02
  • 1
    It sounds like you're doing two things: a job that produces output whose starting and ending characters are of interest, and a separate script that examines the output. Please show us both--or simplified versions of both, to which the question still fully applies. The most common ways of having one task examine the output of another--piping output from one task to another (or, similarly, using process substitution or command substitution), and having one task log to a file which is read by the other--work exactly the same from a cron job. Right now I think it's unclear what your problem is. Oct 24, 2014 at 5:16

0

Browse other questions tagged .