#!/bin/sh # # Script to export lua job files # Parameters: # $1: password used to encrypt the lua file # $2: name of zipped file # $3: path to lua job file # $4: path to lua atom file # $5: temporary path to store the zipped file # Configuration EXPORTER=/home/tool/bin/7za # check exporter if [ ! -e $EXPORTER ]; then echo "Exporter not found" >&2 exit 1 fi # param1 password check if [ $# -eq 0 ]; then echo "Password required" >&2 exit 1 fi PWD=$1 if [ "$PWD" = "" ]; then echo "No empty password" >&2 exit 1 fi # param2 export (zipped) file name if [ $# -eq 1 ]; then echo "Export file name required" >&2 exit 1 fi EXPORTFNAME=$2 if [ "$EXPORTFNAME" = "" ]; then echo "Empty export file name given" >&2 exit 1 fi # param3 the path to file name if [ $# -eq 2 ]; then echo "full target program file name required" >&2 exit 1 fi FILE_LIST="-r "$3 FILE_LIST_ATOM="-r "$4 # param4 the temporary path to save the zipped file if [ $# -eq 3 ]; then echo "temp path name required" >&2 exit 1 fi TARGET_FILE=$5/$EXPORTFNAME # remove previous archive rm -f $TARGET_FILE $EXPORTER a -tzip -mx=1 $TARGET_FILE $FILE_LIST -p$PWD > /dev/null # $EXPORTER a -tzip -mx=1 $TARGET_FILE $FILE_LIST_ATOM -p$PWD > /dev/null sync RETVAL=$? if [ $RETVAL -eq 0 ];then echo Success fi if [ $RETVAL -ne 0 ];then echo Failure fi exit $RETVAL