본문 바로가기

분류 전체보기

리눅스 명령어

2018. 5. 23.







cat /var/log/messages | grep -i error

egrep -i 'error|fail|warn' /var/log/messages








sed ‘s/찾는문자열/바꿀문자열/g’ 입력파일

















참고사이트 (출처)

http://www.incodom.kr/Linux/%EA%B8%B0%EB%B3%B8%EB%AA%85%EB%A0%B9%EC%96%B4











'Infra' 카테고리의 다른 글

vi 편집기 단축키  (0) 2018.06.07
[명령어] df 와 du 의 용량이 다른 이유  (1) 2018.04.24
[RHEL] LVM 명령어  (0) 2018.04.24
[RHEL x] kdump 활성화 및 crash 테스트  (0) 2018.04.24
[RHEL7] 데몬 정리  (0) 2018.04.23
댓글

[Apache] Permission denied: make_sock: could not bind to address [::]:80

2018. 4. 30.
Permission denied: make_sock: could not bind to address [::]:80

 

$ ./apachectl start

httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.149.130 for ServerName

(13)Permission denied: make_sock: could not bind to address [::]:80

(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

Unable to open logs



원인


1024 이하 포트는 root 계정으로만 접근이 가능하다.


나는 jboss 계정으로 기동이 필요하여 아래 조치를 취했다.




 

chown root:jboss httpd

$ chmod +s httpd



 

$ ./apachectl start

httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.149.130 for ServerName

$

$

$ ps -ef | grep -i httpd

root     21454     1  0 03:15 ?        00:00:00 /jboss/apache/bin/httpd -k start

daemon   21455 21454  0 03:15 ?        00:00:00 /jboss/apache/bin/httpd -k start

daemon   21456 21454  0 03:15 ?        00:00:00 /jboss/apache/bin/httpd -k start

daemon   21457 21454  0 03:15 ?        00:00:00 /jboss/apache/bin/httpd -k start

daemon   21458 21454  0 03:15 ?        00:00:00 /jboss/apache/bin/httpd -k start

daemon   21459 21454  0 03:15 ?        00:00:00 /jboss/apache/bin/httpd -k start

jboss    21461 21423  0 03:15 pts/0    00:00:00 grep -i httpd



일반계정으로 해야 하는 경우


$ /etc/sudoers 수정

jboss all:(ALL)


및 


apache/conf/httpd.conf 수정

user jboss

group jboss


'WAS' 카테고리의 다른 글

GossipRouter 설정 방법  (3) 2019.07.23
[Tomcat] DB 패스워드 암호화  (0) 2019.06.27
Session clustering (udp/tcp), sticky session  (0) 2018.11.01
IIS && EAP 연동  (0) 2018.05.30
[limits.conf] 유저 리소스 파라미터 설정  (0) 2018.04.24
댓글

[리눅스] Classpath import

2018. 4. 27.


불러오는 형으로 main 이 없다.


 Printer.java

 package test;  test 에 존재한다.

public class Printer {
    public void print(){
        String html = "<html><body> <h1>my html</h1> </body></html>";
        System.out.println("html:" + html);
         
    }
}


test에 Printer 를 불러온다.


 Hello.java

 import test.Printer;

public class Hello {
         
         
        public static void main(String[] args)
        {
            Printer printer = new Printer();
            printer.print();  
            System.out.println("Hello world!!!");
        }
}


실행


[root@localhost file]# javac Hello.java

[root@localhost file]# javac -d . test/Printer.java

[root@localhost file]# java Hello

html:<html><body> <h1>my html</h1> </body></html>

Hello world!!!



댓글

[리눅스] 키보드로 입력받은 문자 출력하기

2018. 4. 26.

[root@localhost Hello]# vim InputOutput.java


 InputOutput.java

 public class InputOutput {

        public static void main (String[] args) throws Exception {

                int a;    인트형 변수 a 를 정의


                System.out.print ("write please : ");

                a = System.in.read( );   키보드로 입력한 한 개의 문자를 변수 a 에 대입, 입력받은문자를 int형으로 반환한다.


                System.out.println("this write " + (char)a + " good?");   (char)a 는 a를 문자로 출력하라는 것, 안쓰면 숫자로 표기된다.

        }

}


실행

[root@localhost Hello]# javac InputOutput.java


결과

[root@localhost Hello]# java InputOutput

write please : a 문자 입력

this write a good?



System.in.read() 를 사용하는 경우에는 throws Exception 을 붙여야 한다.



댓글

[리눅스] Hello World 출력하기

2018. 4. 26.
[root@localhost Hello]# vim Hello.java 자바 파일 생성

Hello.java 

 public class Hello {

        public static void main(String[] args) {

                System.out.println("Hello World");

        }

}


[root@localhost Hello]# javac Hello.java  자바 컴파일러


[root@localhost Hello]# ll

total 8

-rw-r--r-- 1 root root 416 Apr 26 06:57 Hello.class  클래스 파일 생성

-rw-r--r-- 1 root root 106 Apr 26 06:57 Hello.java



[root@localhost Hello]# java Hello

Hello World



대소문자에 유의하자.


클래스 명이 자바 파일 명이 된다.


Hello.java 

 public class Hello {

        public static void main(String[] args) {

                System.out.println("Hello World");

        }

}


자바 프로그램의 시작 부분, main() 은 자바프로그램의 시작

JVM 은 프로그램을 시작할 때 이 문장을 제일 먼저 찾아서 실행한다.


Hello.java 

 public class Hello {

        public static void main(String[] args) {

                System.out.println("Hello World");

        }

}


System.out.println() 이 문장은 입력한 글자를 출력 한다.


Hello.java 

 public class Hello {

        public static void main(String[] args) {

                System.out.println("Hello World");

        }

}



연습


println 은 print-Line 으로 줄바꿈으로 해석하자.


 Exam01.java

 class Exam01 {

        public static void main(String[] args) {

                System.out.println("Hi");

                System.out.print("My Name is ");

                System.out.print("3sik.");

        }

}


[root@localhost Hello]# javac Exam01.java

[root@localhost Hello]# java Exam01

Hi

My Name is 3sik.






댓글