no message
parent
6eaf39691f
commit
603512e62c
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/expect -f
|
||||
if [ $# -lt 1]
|
||||
then
|
||||
echo "I Hope your input. [TARGET_FILE]"
|
||||
exit
|
||||
fi
|
||||
|
||||
TARGET_FILE=$1
|
||||
SRC_DIR=$2
|
||||
LAYOVER_DIR=$3
|
||||
DEST_DIR=$4
|
||||
DEST_NAME=$5
|
||||
|
||||
java -jar /gpta/source-app/cfs/relay_jar/customSender.jar $TARGET_FILE $SRC_DIR $LAYOVER_DIR $DEST_DIR $DEST_NAME &
|
||||
@ -0,0 +1,82 @@
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class CustomSender {
|
||||
|
||||
public static final Logger logger = Logger.getLogger(CustomSender.class);
|
||||
|
||||
private static String wasWorkDir = "";
|
||||
private static String webWorkDir = "";
|
||||
private static String sujibWorkDir = "";
|
||||
private static String finalDest = "";
|
||||
private static String finalDestWorkDir = "";
|
||||
|
||||
public static void main(String[] args) {
|
||||
String fileName = args[0];
|
||||
wasWorkDir = args[1];
|
||||
webWorkDir = args[2];
|
||||
sujibWorkDir = args[3];
|
||||
finalDestWorkDir = args[4];
|
||||
finalDest = args[5];
|
||||
|
||||
CustomSender self = new CustomSender();
|
||||
|
||||
File file = new File(wasWorkDir + "/" + fileName);
|
||||
|
||||
int ftpResult = self.setFtpData(file, fileName);
|
||||
|
||||
if(ftpResult != -1) {
|
||||
self.deliveryReq(
|
||||
webWorkDir+"/"+file.getName(),
|
||||
sujibWorkDir+"/"+file.getName(),
|
||||
finalDestWorkDir+"/"+file.getName(),
|
||||
finalDest
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void deliveryReq(String srcPath, String layoverPath, String destPath, String destName) {
|
||||
FTPUtil ssh = new FTPUtil();
|
||||
ssh.initExec("175.193.201.56", "tmax","tmax1234");
|
||||
|
||||
ssh.run("curl --insecure -X GET "
|
||||
+ "d \"srcPath="+srcPath+"&layoverPath="+layoverPath+"&destPath="+destPath+"&from=web4&to="+destName+"\" "
|
||||
+ "http://192.168.201.120/deliveryReq.do"
|
||||
);
|
||||
|
||||
ssh.disconnectSession();
|
||||
|
||||
}
|
||||
|
||||
private int setFtpData(File file, String fileNm) {
|
||||
|
||||
FTPUtil sftp = new FTPUtil();
|
||||
|
||||
logger.debug("======== 업로드 시작 : " + fileNm);
|
||||
|
||||
sftp.init("175.193.201.56", "tmax","tmax1234");
|
||||
|
||||
Map<String, String> resultMap = new HashMap<String, String>();
|
||||
resultMap.put("return", "0");
|
||||
|
||||
try {
|
||||
sftp.upload3(webWorkDir+"/", file, resultMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
logger.debug("======== : " + resultMap.get("return"));
|
||||
|
||||
int nReturn = Integer.parseInt(resultMap.get("return"));
|
||||
|
||||
sftp.disconnect();
|
||||
|
||||
logger.debug("======== 업로드 끝 : " + nReturn);
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue