![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CRON problem | rrlog | AIX | 1 | 01-15-2008 02:22 PM |
| cron job problem | mokkan | SUN Solaris | 4 | 12-22-2007 04:25 PM |
| CRON problem | VooDooMan | UNIX for Dummies Questions & Answers | 4 | 07-07-2005 08:06 PM |
| Cron problem | redlotus72 | UNIX for Dummies Questions & Answers | 3 | 06-17-2005 02:22 PM |
| Cron problem | Sn33R | Shell Programming and Scripting | 12 | 10-23-2003 07:08 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem with Cron
Hi i am new here and have a quick question.
i am receiving ./project.sh: line 12: syntax error near unexpected token `newline' ./project.sh: line 12: `echo "`date +"%F %R"` `md5sum /etc/passwd`" >> ' error message here is my script. could you please help! #!/bin/bash # PROGRAM: project.sh # OBJECTIVE: Log changes # AUTHOR: # DATE: May 2009 # MYDIR=$HOME/bin MYLOGDIR=$MYDIR/logs # echo "`date +"%F %R"` `wc /etc/passwd`" >> $MYLOGDIR/checkpasswd_wc.txt # echo "`date +"%F %R"` `md5sum /etc/passwd`" >> $MYLOGDIR/checkpasswd_md5.txt # echo " " >> $MYLOGDIR/passwd_file.txt echo `date +"%F %R"` >> $MYLOGDIR/passwd_file.txt more /etc/passwd >> $MYLOGDIR/passwd_file.txt echo " " >> $MYLOGDIR/passwd_file.txt echo " " >> $MYLOGDIR/passwd_file.txt # echo "`date +"%F %R"` `df -v |grep /home2`" >> $MYLOGDIR/check_ds.txt # echo " " >> $MYLOGDIR/checkds_all.txt echo "`date +"%F %R"`" >> $MYLOGDIR/checkds_all.txt df -v >> $MYLOGDIR/checkds_all.txt echo " " >> $MYLOGDIR/checkds_all.txt echo " " >> $MYLOGDIR/checkds_all.txt # # |
|
||||
|
Even though am not able to find out how you are calling this bash script. I could able to realize that, when you use the % in the crontab it will be taken as newline, you can find more info by googling as percentage + cron - Google Search... from a comment in Andrew Beacock's Blog: Having cron troubles with percent (%) signs in crontabs? Code:
Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|