Subversion Repositories SmartDukaan

Rev

Rev 3568 | Rev 3943 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2266 chandransh 1
#!/bin/bash
2
 
3
# resolve links - $0 may be a softlink
4
PRG="$0"
5
 
6
while [ -h "$PRG" ]; do
7
  ls=`ls -ld "$PRG"`
8
  link=`expr "$ls" : '.*-> \(.*\)$'`
9
  if expr "$link" : '/.*' > /dev/null; then
10
    PRG="$link"
11
  else
12
    PRG=`dirname "$PRG"`/"$link"
13
  fi
14
done
15
 
16
# Get standard environment variables
17
PRGDIR=`dirname $(readlink -f "$PRG")`
18
 
19
MEDIA_EXPORT_PATH="/var/www/"
20
PARTNERS_PATH="/var/www/static.saholic.com/partners/"
21
WEBSITE_JAVASCRIPT_PATH="/var/www/static.saholic.com/js/"
22
LATEST_TIMESTAMP=`cat /catalog-dumps/latest.timestamp`
3568 chandransh 23
DATE=`date +%Y-%b-%d_%Hh%Mm`
24
LOGFILE=${MEDIA_EXPORT_PATH}/${DATE}.log               # Log file Name
25
LOGERR=${MEDIA_EXPORT_PATH}/ERRORS-${DATE}.log         # Error Log file Name
2266 chandransh 26
 
3568 chandransh 27
# IO redirection for logging.
28
touch ${LOGFILE}
29
exec 6>&1           # Link file descriptor #6 with stdout.
30
                    # Saves stdout.
31
exec > ${LOGFILE}     # stdout replaced with file ${LOGFILE}.
32
touch ${LOGERR}
33
exec 7>&2           # Link file descriptor #7 with stderr.
34
                    # Saves stderr.
35
exec 2> ${LOGERR}     # stderr replaced with file ${LOGERR}.
36
 
2266 chandransh 37
echo "Updating product list for partners"
38
echo "======================================================="
39
cd ${MEDIA_EXPORT_PATH}
40
tar -zxf partners.tgz
41
unlink partners
42
ln -s partners-${LATEST_TIMESTAMP} partners
43
cp -r partners/* ${PARTNERS_PATH}
44
 
45
echo "Updating javascripts for product comparison"
46
echo "======================================================="
47
tar -zxf javascripts.tgz
48
unlink javascripts
49
ln -s javascripts-${LATEST_TIMESTAMP} javascripts
50
cp -r javascripts/* ${WEBSITE_JAVASCRIPT_PATH}
51
 
3568 chandransh 52
#Clean up IO redirection
53
exec 1>&6 6>&-      # Restore stdout and close file descriptor #6.
54
exec 2>&7 7>&-      # Restore stdout and close file descriptor #7.
55
 
56
if [ -s "${LOGERR}" ]
57
        then
58
                exit 1
59
        else
60
                exit 0
61
fi