#!/usr/bin/ksh

############################################################################
# script name: pdCopy
#
# Description of the script:
# --------------------------
#    Copies executables, libsock.a,
#    from /pd_dev to /pd_gui/pd_int.  Copies pd_gui/pd_int to pd_gui/pd_int_old
#
#
############################################################################

# PDGUI_BASE: target directory for gui copy of /pd_dev                        `
PDGUI_BASE=/pd_gui/pd_int

# PDGUI_BASEOLD: target directory for gui old copy
PDGUI_BASEOLD=/pd_gui/pd_int_old

# PDBASE: source directory for Pd base code executables
PDBASE=/pd_dev
# PDBASE=/pd_user/nrzesch/pd


#--------------------------------------------------------------------------
for i in `ps -ef | grep "spooler" | egrep -v grep | awk ' { print $2 } '`
do
  kill -9 $i
done

for i in `ps -ef | grep "supervisor" | egrep -v grep | awk ' { print $2 } '`
do
  kill -9 $i
done

for i in `ps -ef | grep "pdclientd" | egrep -v grep | awk ' { print $2 } '`
do
  kill -9 $i
done

for i in `ps -ef | grep "basicdsd" | egrep -v grep | awk ' { print $2 } '`
do
  kill -9 $i
done


   # save the old files in an tar file and compress it
#  echo "\nCompressing old $PDGUI_BASE" >> $SUMFILE
#  tar -cvlf $PDGUI_BASEOLD/pd_int_backup_04_04.tar  $PDGUI_BASE/bin
#  compress $PDGUI_BASEOLD/pd_int_backup_04_04.tar
#  shared libs
#  tar -cvlf $PDGUI_BASEOLD/pd_lib_backup_04_04.tar  /usr/lpp/pd/lib
#  compress $PDGUI_BASEOLD/pd_lib_backup_04_04.tar

   # copy from $PDBASE
   rcp pdq:$PDBASE/bin/pdclientd   ferrari:$PDGUI_BASE/bin/pdclientd
   rcp pdq:$PDBASE/bin/spooler     ferrari:$PDGUI_BASE/bin/spooler
   rcp pdq:$PDBASE/bin/supervisor  ferrari:$PDGUI_BASE/bin/supervisor
   rcp pdq:$PDBASE/bin/startspl    ferrari:$PDGUI_BASE/bin/startspl
   rcp pdq:$PDBASE/bin/startsuv    ferrari:$PDGUI_BASE/bin/startsuv
   rcp pdq:$PDBASE/bin/odbgen      ferrari:$PDGUI_BASE/bin/odbgen
   rcp pdq:$PDBASE/src/oid/*.db    ferrari:$PDGUI_BASE/src/oid
   rcp pdq:$PDBASE/bin/pddmsg      ferrari:$PDGUI_BASE/bin/pddmsg
   rcp pdq:$PDBASE/bin/pdcrdflt    ferrari:$PDGUI_BASE/bin/pdcrdflt
   rcp pdq:$PDBASE/bin/pdcommand   ferrari:$PDGUI_BASE/bin/pdcommand
   rcp pdq:$PDBASE/inc/oid_def.h   ferrari:$PDGUI_BASE/inc/oid_def.h
   rcp pdq:$PDBASE/lib/*.a         ferrari:/usr/lpp/pd/lib
   rm /usr/lpp/pd/lib/*ns.a
   cp $PDBASE/src/common/fpa.cat $PDGUI_BASE/En_US
   cp $PDBASE/src/oid/ibm*.cat $PDGUI_BASE/En_US/Pd
   cp $PDBASE/oids/*.db $PDGUI_BASE/oids
   chmod 555 $PDGUI_BASE/bin/*
   chgrp printq $PDGUI_BASE/bin/supervisor
   chown root $PDGUI_BASE/bin/supervisor
   chmod 6555 $PDGUI_BASE/bin/supervisor
   chown root $PDGUI_BASE/bin/pdclientd
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdclean
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdcreate
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pddelete
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pddisable
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdenable
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdgate
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdinterrupt
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdls
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdpause
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdmod
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdpr
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdpromote
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdq
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdresubmit
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdresume
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdrm
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdset
   ln -s $PDGUI_BASE/bin/pdcommand $PDGUI_BASE/bin/pdshutdown
   cd $PDGUI_BASE/src/oid
   ../../bin/odbgen -g $PDGUI_BASE guioid.db
   echo "\nCopied new files from $PDBASE to $PDGUI_BASE" >> $SUMFILE
   echo "\nCleaning PP temp files"
   rm /var/spool/lpd/pio/ddi/*PD*

#
#    Version      Date     Time    Owner   Comment
# ------------- -------- -------- -------- ----------------------------
# V             04/08/95 09:42:58 boldt    save base code copy scripts
# V1.2          04/11/95 07:45:27 boldt    update Pd dir
# V1.3          04/20/95 06:39:10 boldt    remove backup
