![]() |
|
|
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 |
| Telnet Script Issues | Darknight | Shell Programming and Scripting | 10 | 02-09-2009 03:09 PM |
| UNIX Guru's help on diff | ajaybalki | Shell Programming and Scripting | 2 | 06-22-2006 06:51 PM |
| Reboot problem !!! urgent plse !!!!!!!!!!! | tt155 | SUN Solaris | 8 | 01-15-2006 01:33 AM |
| define nvalias's cdrom URGENTLY plse!!! | tt155 | SUN Solaris | 1 | 11-21-2005 07:38 AM |
| what do most Unix guru's use ? :D | simon2000 | UNIX for Advanced & Expert Users | 6 | 09-01-2003 10:00 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
UNIX script issues - Plse help guru's
Hi,
I have written the following UNIX for HP-UX 11i. The script basically checks for files older then 45mins in 2 repective directories and then sends and email to the administrator about them. Problem with the script is that I can run it from the command line and crontabtab but 80% of the time it errors out with the following error message "date: bad conversion". I'm puzzled as to why it works brilliantly sometimes and why majority of the times it errors out with the above error message. Can a UNIX scripting guru please advise. Script displayed below: #!/usr/bin/ksh mailgroup='testuser@xxx.com' LOGFILEIN=/tmp/sipstimein.log LOGFILEPROC='/tmp/sipstimeproc.log' #GET AND PARSE THE CURRENT DATE date "+%m %d %H %M" | while read MONTH DAY HOURS MINS do #SUBTRACT 45 MIN MINS=$(($MINS-45)) if [ $MINS -lt 0 ] then HOURS=$(($HOURS-1)) MINS=$(($MINS+60)) fi #TOUCH A FILE SO THAT IT IS 45 MINUTES OLD touch -t ${MONTH}${DAY}${HOURS}${MINS} /tmp/oldtime done #Find files older then 45mins condition find /interface/data8/sips/proc ! -newer /tmp/oldtime | while read FILENAME do #CHECK THAT IT IS A REGULAR FILE, AND NOT A DIR OR # CHARACTER FILE, BEFORE RUNNING THE COMMAND AGAINST IT if [ -f $FILENAME ] then echo "$FILENAME" >$LOGFILEIN sleep 4 mailx -s "Files have been detected older then 45mins in PROD system for SIPS in the PROC directory" <$LOGFILEIN $mailgroup 2>&1 fi done find /interface/data8/sips/in ! -newer /tmp/oldtime | while read FILENAME do #CHECK THAT IT IS A REGULAR FILE, AND NOT A DIR OR # CHARACTER FILE, BEFORE RUNNING THE COMMAND AGAINST IT if [ -f $FILENAME ] then echo "$FILENAME" >$LOGFILEPROC sleep 4 mailx -s "Files have been detected older then 45mins in PROD system for SIPS in the IN directory" <$LOGFILEPROC $mailgroup 2>&1 fi done #rm /tmp/oldtime THANKS and help appreciated. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|