pl. examin this script
i am having a problem in executing this file, if condition when is am putting wild card "*"
then it has problem to run script.
error:
statsdataimport.sh: line 6: [: too many arguments
Files Not there yet
pl have a look on to this problem...
---------------------------------------------------------------------------------------
#!/bin/bash
rm -rf /opt/scripts/lk/*
cd /home/cricarc/
if [ -f "`date -d "1 day ago" "+%d"`_`date +%b |tr '[A-Z]' '[a-z]'`_`date +%Y`"* ]; then
echo good
cp -rf `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`* /opt/scripts/lk
else
echo "Files Not there yet"
exit 0;
fi
cd /opt/scripts/lk
gunzip *.gz
sh /opt/scripts/ko.sh
cd /opt/scripts/lk
if [ `mysqladmin -uroot -phexademon ping|grep alive|wc -l` = 1 ]; then
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_close_of_play
echo "Done 1"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_ground
echo "Done 2"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_innings
echo "Done 3"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_match_award
echo "Done 4"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_match_official
echo "Done 5"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_player
echo "Done 6"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_player_team
echo "Done 7"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_scorecard
echo "Done 8"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_innings_bowling
echo "Done 9"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_team
echo "Done 10"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_fall_of_wickets
echo "Done 11"
/usr/local/mysql/bin/mysql -uroot -phexademon cricarc < `date -d "1 day ago" "+%d"`_`date +%b | tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_innings_batting
echo "Done 12"
sleep 1
rm -f /opt/scripts/lk/*
else
service mysql restart
fi
---------------------------------------------------------------------------------------
here is ko.sh
#!/bin/sh
cd /opt/scripts/lk/
listfile(){
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_close_of_play `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_close_of_play
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_fall_of_wickets `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_fall_of_wickets
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_ground `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_ground
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_innings `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_innings
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_match_award `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_match_award
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_match_official `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_match_official
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_player `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_player
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_player_team `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_player_team
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_scorecard `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_scorecard
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_innings_bowling `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_innings_bowling
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_innings_batting `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_innings_batting
mv `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`*_web18_team `date -d "1 day ago" "+%d"`_`date | awk '{ print $2}'|tr '[A-Z]' '[a-z]'`_`date +%Y`_web18_team
}
listfile | awk '{print $9}' > lp.txt
|