LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-07-2005, 07:12 PM   #1
zzyzx
LQ Newbie
 
Registered: Feb 2005
Distribution: Slackware 10.1
Posts: 20

Rep: Reputation: 0
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
It runs fine from the command line (w/ filenames not variables) and when I execute the script myself, ./<script>, but when it runs from cron it chokes on this command. The stderr output is:

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!
 
Old 04-08-2005, 08:37 AM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
Are you sure there is not space between < and ( in crontab ?
 
Old 04-08-2005, 01:20 PM   #3
zzyzx
LQ Newbie
 
Registered: Feb 2005
Distribution: Slackware 10.1
Posts: 20

Original Poster
Rep: Reputation: 0
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.
 
Old 04-12-2005, 01:27 PM   #4
zzyzx
LQ Newbie
 
Registered: Feb 2005
Distribution: Slackware 10.1
Posts: 20

Original Poster
Rep: Reputation: 0


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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
bash script & cron probs. skubik Programming 17 10-16-2005 03:00 PM
Cron script troubles Galphar Linux - Newbie 1 01-19-2005 02:32 PM
bash script from cron kubla Programming 3 01-22-2004 05:30 AM
webmin,cron and bash login script colesen Linux - Software 0 08-12-2003 08:36 PM


All times are GMT -5. The time now is 10:33 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration