cron bash script troubles
Having a trouble understanding the problem with the following command:
Code:
comm -23 <(grep 'sshd.*Connection from\|Invalid' /var/log/sshd.log) $WKLOG > $TMPLOG line 11: syntax error near unexpected token `(' line 11: comm -23 <(grep 'sshd.*Connection from\|Invalid' /var/log/sshd.log) $WKLOG > $TMPLOG Any idea what's causing the change from command line to cron? Both are running as root. Thanks for any help! |
Are you sure there is not space between < and ( in crontab ?
|
No space. Actually this is just part of the script, which I can run fine outside of cron. My crontab entry just runs the script:
*/10 * * * * /root/cronscripts/sshd_access.sh 2> /root/log/errorsshd Tthe only difference is that it doesn't like that line. Does cron run through a different shell? I'm new to bash and Linux for that matter and I'm totally at a loss. |
:newbie:
Ok, I found the problem and it is embarrassing. The script was missing the magic line #!/bin/bash. <Hang head in shame>I'm such a newb</hang head in shame> Anyway, happy days, my script runs on cron. And lesson learned: the magic line is necessary. Although, I'm still wondering what shell crond uses by default. Anyone know? |
All times are GMT -5. The time now is 07:25 AM. |