Glam Prestige Journal

Bright entertainment trends with youth appeal.

In crontab I have this job script :

0 5 * * * /home/user/job_h.bash > /home/user/log_h.log > 2&1 

where the job_h.bash contains :

#!/usr/bin/env bash
set -e
source /home/user/pyenv/test/bin/activate
python3 /home/user/pyenv/test/d_h.py
deactivate

However it outputs "/bin/sh: 1: Syntax error: redirection unexpected"

Would you please help me to understand ? I'm pretty sure that i'm using the right shebang and finally the python isn't executed 🤷‍♀️

Thank you,

3

1 Answer

I almost certain your redirection for stderr is wrong. (the last 3 characters) Try

 home/user/job_h.bash > /home/user/log_h.log 2>&1 

The problem is your command, as written is trying to redirect stdout twice.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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