Bad status in UNIX Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bad status in UNIX Script
# 1  
Old 01-31-2014
Bad status in UNIX Script

Hello,

sorry for my questions about that below script but i have an error that i don't understand.
It seems that my find command is not working fine but for me the command is ok

Thanks for your help
Code:
=====================================
/usr/IBM/HTTPServer/apache_cache
/usr/IBM/HTTPServer/apache_cache/toto.txt
find: bad status-- –name
find: bad status-- ‘*’
find: bad status-- –mtime
find: bad status-- +1
find: bad status-- –exec
find: bad status-- rm
find: bad status-- {}
find: bad status-- ;

==========================================




Code:
#!/bin/sh
# About the script
#==============================================================================
# author       : Vision IT Group
# version      : 1.0
# date written : January 2014
# application  : delete -mtime +1 files in the apache_cache
#==============================================================================
#
################################ PATH ###########################################

DATUM1="$(date +%y%m%d.%H%M%S)"
NAME="CacheIHS_Logs"
PATHCACHELOGS="/usr/IBM/HTTPServer/logs/"
LOG_FILE=$PATHCACHELOGS/$NAME.log

################################ CODE ###########################################
#echo "find files to delete in the cache"
#echo "---------------------------------"
find "/usr/IBM/HTTPServer/apache_cache" –name ‘*’ –mtime +1 –exec rm {} \;

#Define Logfilename
#------------------
echo "Clear done ..."$DATUM1 >> $LOG_FILE
echo "---------------------------------------" >> $LOG_FILE

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data..

Last edited by vbe; 01-31-2014 at 08:18 AM..
# 2  
Old 01-31-2014
Why different single quote characters?

Code:
-name ‘*'

Why are you using two different single-quote characters as the delimiters?
Or perhaps that was just how your script was copied into the message. But, I would try to use the ' character that is on the same key as the " character.
# 3  
Old 01-31-2014
Hello,

thanks but the same result with simple quote ..Sorry also without quote

Thanks for your help
# 4  
Old 01-31-2014
What files are you trying to find?

The top of your script has a variable for NAME, but then your command to find appears to be looking for * or all files. Confused by this.
# 5  
Old 01-31-2014
The problem are the chars ‘ ’ – that are similar but different: the probelm occurs when copy and paste code in msoffice:
Code:
find /usr/IBM/HTTPServer/apache_cache -name \* -mtime +1 -exec rm {} \;

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find command giving bad status error

In a fastload teradata utility I am trying to delete the files which are older than 30days using the find and rm command as following. find . -name 'xxx_*' -mtime +30 -exec rm -f {} \; I expect it to delete all the files older than 30 days but sometimes it gives an error : find: bad status--... (3 Replies)
Discussion started by: stelkar
3 Replies

2. UNIX for Dummies Questions & Answers

find command on a empty directory - bad status

when I run the following command in AIX (bash), find ./* I get the following error. find: bad status-- ./* Thats becasuse, its an empty directory. The same works, when there the directory is not empty. Even though the find deesnt have to rerun any result. My full find command would look... (4 Replies)
Discussion started by: deepakwins
4 Replies

3. Shell Programming and Scripting

UNIX script to check multiple jobs runninng status

Hi Folks, Please help me ,I need a unix shell script to check for multiple jobs running. if there are multiple backup Jobs running then it should be trigger an email . Thanks, Anand T (1 Reply)
Discussion started by: nandu67
1 Replies

4. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

5. UNIX for Dummies Questions & Answers

Find command returning bad status--

would like to remove the post (8 Replies)
Discussion started by: vk39221
8 Replies

6. Red Hat

nfs_stat_to_errno: bad nfs status return value: 88

Hi, I'm getting this message from my 64bit Redhat 5.5 NFSv3 clients. They are mounting an Oracle 7110 Array that is exporting the NFS shares. nfs_stat_to_errno: bad nfs status return value: 88 As the 7110 is a Solaris/ZFS array I've traced the errno 88 to be an "Illegal Byte Sequence" by... (2 Replies)
Discussion started by: general_lee
2 Replies

7. Shell Programming and Scripting

Connect status of db2 in Unix shell script

Hi I am trying to connect to db2 database from Unix shell script (k shell) I need to catch the status of connect whether it is succesful or not. ---------------------------------------------------------- # Read login credentials for db2 tput clear echo "Please enter your Userid:\c"... (3 Replies)
Discussion started by: mKarri
3 Replies

8. UNIX for Dummies Questions & Answers

unix script to check if rsh to box and send status mail

rshstatus=`rsh -n lilo /db/p2/oracle/names9208/restart_names.sh` if $rshstatus <>0 then errstatus=1 mailx -s "xirsol8dr" ordba@xxx.com >> $log_dr else if errstatus=0 echo "status to xirsol8dr successful" can anyone provide if this is t he correct way to do this or is there a better way? (1 Reply)
Discussion started by: bpm12
1 Replies

9. Shell Programming and Scripting

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (2 Replies)
Discussion started by: shilendrajadon
2 Replies

10. UNIX for Advanced & Expert Users

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (1 Reply)
Discussion started by: shilendrajadon
1 Replies
Login or Register to Ask a Question