Files
storage_fresco/scripts/cron_move.sh
2019-05-23 13:36:01 +00:00

37 lines
996 B
Bash
Executable File

#!/bin/sh -e
#
# move files to storage
#
DATER=`date +%b%_3d%_9T`
#
#
echo $DATER chargencopy: starting procedure
FILES=`/usr/bin/find /opt/smb_lotnr -maxdepth 1 -name "*txt" -type f | /usr/bin/wc -l`
if [ $FILES -eq 0 ];
then
echo $DATER chargencopy: Nothing to do
echo $DATER chargencopy: terminated with error 2
exit 2
fi
if !(/bin/mount -t smbfs -o user=ela,password=matstamm,domain=linznet //172.41.31.16/input/pick /mnt/chargen_bizerba)
then
#/bin/umount //172.41.31.16/input
echo $DATER chargencopy: mount failed: could not mount remote share
echo $DATER chargencopy: terminated with error 1
exit 1
fi
#if !(/usr/bin/find /opt/smb_lotnr -maxdepth 1 -name "*txt" )
if [ $FILES -eq 0 ];
then
/bin/umount //172.41.31.16/input
echo $DATER chargencopy: no files
echo $DATER chargencopy: terminated with error 2
exit 2
fi
cp /opt/smb_lotnr/*txt /mnt/chargen_bizerba
#mv /opt/smb_lotnr/*txt /opt/smb_lotnr/archive
rm /opt/smb_lotnr/*txt
/bin/umount //172.41.31.16/input