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
deactivateHowever 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,
31 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.