0

i run this command on the terminal

$ my_json_generator.rb | grep \"mtype\":164 | my_json_consumer.rb

json_generator creates json objects. 1 per line.

{"foo":7, "mtype":164, "bar":[1,2,3]}

I only need lines that contain mtype of 164 and for performance reasons ( and others outside the scope of this question ) i would like to avoid parsing the other json lines into objects. I recognize I could do this in code but need to avoid it.

So, the above command works on the terminal, but not in cron. Any suggestions appreciated.

Thanks!

2 Answers 2

0

I guess you have a $PATH problem.

Try putting the full PATH of the executables, or add at the beginning of your crontab :

SHELL=/bin/bash
PATH=/bin:/usr/bin:/usr/local/bin
[email protected]

* * * * * my_json_generator.rb | grep \"mtype\":164 | my_json_consumer.rb
0

What do you mean it doesn't work? Try removing the backslash from the Crontab entry. It might be double escaped.

You must log in to answer this question.

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