no message

main
이범준 3 months ago
parent 907be1709e
commit 0ff49401b7

@ -66,7 +66,7 @@ public class FTPUtil {
}
public void initExec(String host, String user, String password) {
public void initExec(String host, String user, String password, int port) {
System.out.println(host);
System.setProperty("java.net.preferIPv4Stack", "true");
@ -76,7 +76,7 @@ public class FTPUtil {
JSch jsch = new JSch();
try {
// 2. 세션 객체를 생성한다(사용자 이름, 접속할 호스트, 포트를 인자로 전달한다.)
session = jsch.getSession(user, host, 10040);
session = jsch.getSession(user, host, port);
// 3. 패스워드를 설정한다.
session.setPassword(password);

@ -1,8 +1,8 @@
import org.apache.log4j.Logger;
public class SshSshTouch {
public class SshSh {
public static final Logger logger = Logger.getLogger(SshSshTouch.class);
public static final Logger logger = Logger.getLogger(SshSh.class);
private static String targetSys = "";
@ -17,7 +17,7 @@ public class SshSshTouch {
targetSys = args[0];
SshSshTouch self = new SshSshTouch();
SshSh self = new SshSh();
try {
self.run();
@ -30,13 +30,13 @@ public class SshSshTouch {
private void run() throws Exception {
FTPUtil ssh = new FTPUtil();
ssh.initExec("175.193.201.56", "tmax","tmax1234");
ssh.initExec("175.193.201.56", "tmax","tmax1234", 10040);
try {
String cmd = "";
String sshTouchPrefix = "sshpass -p tcs ssh -o StrictHostKeyChecking=no tcs@192.168.201.120 touch /home/tcs/touch/";
String cmdPrefix = "/gpta/source-web/cfs/relay/ssh_touch.sh ";
if(targetSys.equals("monitoring")) {
cmd = sshTouchPrefix+"monitoring";
cmd = cmdPrefix+"monitoring";
} else {
}

@ -0,0 +1,53 @@
import org.apache.log4j.Logger;
public class SshTouch {
public static final Logger logger = Logger.getLogger(SshSh.class);
private static String targetSys = "";
public static void main(String[] args) {
if(args.length != 1) {
System.err.println("총 1개의 args를 입력하지 않았습니다.");
System.exit(0);
return;
}
targetSys = args[0];
SshTouch self = new SshTouch();
try {
self.run();
} catch (Exception e) {
e.printStackTrace();
}
}
private void run() throws Exception {
FTPUtil ssh = new FTPUtil();
ssh.initExec("162.168.201.120", "tcs", "tcs", 22);
try {
String cmd = "";
String cmdPrefix = "touch /home/tcs/touch/ ";
if(targetSys.equals("monitoring")) {
cmd = cmdPrefix+"monitoring";
} else {
}
if(!cmd.equals("")) {
ssh.setCommand(cmd);
}
ssh.disconnectExec();
} catch (Exception e) {
}
return;
}
}

@ -8,4 +8,4 @@ fi
TARGET_SYS=$1
java -jar /gpta/source-app/cfs/relay_jar/ssh-ssh-touch.jar $TARGET_SYS &
java -jar /gpta/source-app/cfs/relay_jar/ssh-sh.jar $TARGET_SYS &

@ -0,0 +1,11 @@
#!/bin/bash
#!/usr/bin/expect -f
if [ $# -lt 1]
then
echo "I Hope your input. [TARGET_SYS]"
exit
fi
TARGET_SYS=$1
java -jar /gpta/source-web/cfs/relay/ssh-touch.jar $TARGET_SYS &
Loading…
Cancel
Save