Server(Windows&Linux)2020. 3. 24. 17:42

Yum 을 이용한 다운로드 하기

~]# yum install cronolog --downloadonly --downloaddir=.

옵션 --downloadonly

다운로드 디렉토리 지정 --downloaddir=.

. 은 현재 디렉토리

 

 

인줄 알았는데 더 쉬운게 있네요.

~]# yumdownloader cronolog

진짜 끝.

Posted by 비니미니파파
Server(Windows&Linux)2020. 1. 2. 12:04

oralce sqlplus 에서 history 사용을 하려면 rlwrap 을 설치 하여야 한다.

Centos 7.7 환경

rlwrap 을 설치 하려면 epel-release 를 먼저 설치 한다.

~]# yum install epel-release

설치 후 rlwrap 을 설치 한다.

~]# yum install rlwrap

설치는 일단 끝이다. 너무 쉽다.

sqlplus 에 alias 설정하면 끝난다. .bash_profile 에 설정 하자.

~]# vi ~/.bash_profile 

-- 중략 --

alias sqlplus='rlwrap sqlplus'

sqlplus 실행 > 명령 실행 > 방향키(화살표) 로 테스트 해 보면 잘 된다.

끝났다.

Posted by 비니미니파파
Database/PostgreSQL2019. 7. 31. 16:16

psql 실행 후 원하는 테이블을 조회하면서 csv 파일로 복사한다.

copy (select * from 테이블명) to '/원하는경로/result.csv' with csv 

끝이다.

=# copy (SELECT * FROM table_demo) to '/home/demo/table_demo_data.20190731.csv' with csv
Posted by 비니미니파파
Database/PostgreSQL2019. 7. 31. 16:09

* CentOS 에서 기본으로 postgresql 가 설치되어있는지 확인한다.

~]# rpm -qa | grep postgres
postgresql-docs-9.2.24-1.el7_5.x86_64
postgresql-libs-9.2.24-1.el7_5.x86_64
postgresql-9.2.24-1.el7_5.x86_64
postgresql-server-9.2.24-1.el7_5.x86_64

* 설치된 것이 있다면 삭제 한다.

~]# yum remove postgresql*

* PostgreSQL 11 버전을 설치 하기 위해서는 Yum repository 를 업데이트 해야 한다.

~]# rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm 

* PostgreSQL 11 을 설치 한다.

~]# sudo yum install -y postgresql11-server postgresql11-contrib 

postgresql11-server : PostgreSQL 11 Database Server
postgresql11-contrib : 추가 지원 모듈

주의! 설치 후 최초 Database 를 생성 해야 한다 !

~]# /usr/pgsql-11/bin/postgresql-11-setup initdb 


* 서비스 등록 및 실행 

~]# systemctl start postgresql-11 
~]# systemctl enable postgresql-11 

* 서비스 상태 확인

~]# systemctl status postgresql-11 


* 관리자 passsword 변경

~]# su - postgres -c 'psql' 
=# ALTER USER postgres PASSWORD '변경할비밀번호'; 

-- postgres 사용자 권한으로 psql 명령어 실행 

* 외부 접속 허용

~]# vi /var/lib/pgsql/11/data/postgresql.conf  

-- 중략 --
listen_addresses = '*' 

-- 중략 --

 

~]# vi /var/lib/pgsql/11/data/pg_hba.conf 

-- 중략 --

host      all             all         0.0.0.0/0      md5 


* 외부 접속 허용 후 서비스를 Restart 해 줘야 한다.

~]# systemctl restart postgresql-11 


* 방화벽 허용

~]# firewall-cmd --permanent --zone=public --add-port=5432/tcp 
~]# firewall-cmd --reload
Posted by 비니미니파파
Java&Jsp&Servlet2019. 4. 19. 16:56

Servlet SpecJSP SpecEL SpecWebSocket SpecAuthentication (JASIC) SpecApache Tomcat VersionLatest Released VersionSupported Java Versions

6.0 3.1 5.0 TBD TBD 10.1.x 10.1.0-M6 (alpha) 11 and later
5.0 3.0 4.0 2.0 2.0 10.0.x 10.0.12 8 and later
4.0 2.3 3.0 1.1 1.1 9.0.x 9.0.54 8 and later
3.1 2.3 3.0 1.1 1.1 8.5.x 8.5.72 7 and later
3.1 2.3 3.0 1.1 N/A 8.0.x (superseded) 8.0.53 (superseded) 7 and later
3.0 2.2 2.2 1.1 N/A 7.0.x (archived) 7.0.109 (archived) 6 and later
(7 and later for WebSocket)
2.5 2.1 2.1 N/A N/A 6.0.x (archived) 6.0.53 (archived) 5 and later
2.4 2.0 N/A N/A N/A 5.5.x (archived) 5.5.36 (archived) 1.4 and later
2.3 1.2 N/A N/A N/A 4.1.x (archived) 4.1.40 (archived) 1.3 and later
2.2 1.1 N/A N/A N/A 3.3.x (archived) 3.3.2 (archived) 1.1 and later

 

http://tomcat.apache.org/whichversion.html

 

Apache Tomcat® - Which Version Do I Want?

Apache Tomcat® is an open source software implementation of a subset of the Jakarta EE (formally Java EE) technologies. Different versions of Apache Tomcat are available for different versions of the specifications. The mapping between the specifications

tomcat.apache.org

Posted by 비니미니파파
Database/PostgreSQL2019. 4. 16. 17:56

PostgreSQL 프로시져 를 구현 하고자 할때 Function 을 만들어 사용한다.

(최신버전 11 부터는 procedure 를 지원한다.)

결과가 없는 Function을 실행 할 때에는 select 대신 PERFORM 을 사용하자.

PERFORM FUNCTION_NAME();

결과가 있는 Function 이라면 당연히 select 를 사용한다.

SELECT FUNCTION_NAME();

 

Posted by 비니미니파파
Server(Windows&Linux)2019. 4. 16. 10:57

서버에 접속 했더니 ssh 접속 시도 건수 가 엄청 나다 ㅜㅜ

ssh 접속 실패로그를 확인 하고 차단해 버리자!

~]# lastb | more

또는 

~]# last -f /var/log/btmp | more

 

* last, lastb 명령어는


NAME
       last, lastb - 사용자들의 마지막 로그인했는 기록 목록을 보여준다.

SYNOPSIS
       last [-R] [-num] [ -n num ] [-adx] [ -f file ] [name...]  [tty...]
       lastb [-R] [-num] [ -n num ] [ -f file ] [-adx] [name...]  [tty...]

DESCRIPTION
       Last  명령은  /var/log/wtmp  파일이나, -f 옵션에서 지정한 파일을 통해서
       사용자의 로그인, 로그아웃 시간을  보여준다.   특정  사용자의  이름이나,
       tty를  지정할 수 있으며, 이렇게 지정되면, 해당 사용자의 로그인 정보만을
       보여준다.  tty의 이름은 생략될 수 있어, last 0 명령은 last tty0  명령과
       같은 기능을 한다.  last가 실행 중에 SIGINT(인터럽트 글쇠, 주로 Ctrl-C에
       의해서 만들어지는 신호)가 감지되거나, SIGQUIT(마침 글쇠, 주로  Ctrl-\에
       의해서 만들어지는 신호)가 감지되면, 실행을 마친다.

       접속  사용자  이름에  reboot라고  나오는  것은  시스템이  reboot된 것을
       나타낸다. 즉 last reboot 명령으로 기록 파일이  만들어진  후부터  reboot
       되었는 기록을 모두 볼 수 있다.

       Lastb  명령은 접속 실패를 기록하는 파일인 /var/log/btmp 파일을 대상으로
       한다는 것을 제외하고는 last 명령과 같다.

OPTIONS
       -num   num 만큼의 줄만 보여준다.

       -n num 윗 기능과 같음.

       -R     hostname 필드를 보여주지 않음.

       -a     hostname 필드를 마지막에 보여줌.  이  옵션은  다음  옵션과  함께
              요용하게 쓰임.

       -d     다른 호스트에서 접속한 것만 보여줌.

       -x     shutdown이 일어난 상태나, run level이 바뀐 상태도 보여줌.

NOTES
       wtmp  파일이나,  btmp 파일이 없을 수도 있다.  시스템은 이런 파일이 있을
       경우에만, 로그인 정보를 그 파일에 기록한다.  만약 없는데, 이제부터 last
       명령을  사용하고  싶다면, 단지 간단하게 touch 명령을 사용해서 각 파일을
       만들어 놓으면 된다.  (예를 들면, touch /var/log/wtmp).

 

* 접속 실패가 확인 된 IP는 firewall-cmd 로 막아버리자.

Posted by 비니미니파파
Database/PostgreSQL2019. 4. 10. 09:29

터미널 에서 postgres 사용자 전환 후 psql 을 실행 한다.

~]# su - postgres

~]$ psql

적용할 데이터베이스 로 이동 후 pgcrypto 를 설치 한다.

# \c demo_db

# CREATE EXTENSION pgcrypto;
Posted by 비니미니파파
Server(Windows&Linux)2019. 4. 10. 09:08

CentOS 7.x

특정 IP 에서 침입 시도가 계속 될 경우 IP 를 막아 보자

~]# firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='123.123.123.123' reject"

~]# firewall-cmd --reload

~]# firewall-cmd --list -all

firewall-cmd --reload
추가한 설정을 적용 하자

firewall-cmd --list -all 
설정이 잘 적용 되었는지 확인 하자.

Posted by 비니미니파파
Server(Windows&Linux)2019. 4. 9. 10:49
~]# pm2 list

pm2 프로세스 확인

 

~]# pm2 scale app_name 4

app_name 클러스터를 4개로 조절

pm2 기본 명령어

# Fork mode
pm2 start app.js --name my-api # Name process

# Cluster mode
pm2 start app.js -i 0        # Will start maximum processes with LB depending on available CPUs
pm2 start app.js -i max      # Same as above, but deprecated.
pm2 scale app +3             # Scales `app` up by 3 workers
pm2 scale app 2              # Scales `app` up or down to 2 workers total

# Listing

pm2 list               # Display all processes status
pm2 jlist              # Print process list in raw JSON
pm2 prettylist         # Print process list in beautified JSON

pm2 describe 0         # Display all informations about a specific process

pm2 monit              # Monitor all processes

# Logs

pm2 logs [--raw]       # Display all processes logs in streaming
pm2 flush              # Empty all log files
pm2 reloadLogs         # Reload all logs

# Actions

pm2 stop all           # Stop all processes
pm2 restart all        # Restart all processes

pm2 reload all         # Will 0s downtime reload (for NETWORKED apps)

pm2 stop 0             # Stop specific process id
pm2 restart 0          # Restart specific process id

pm2 delete 0           # Will remove process from pm2 list
pm2 delete all         # Will remove all processes from pm2 list

# Misc

pm2 reset <process>    # Reset meta data (restarted time...)
pm2 updatePM2          # Update in memory pm2
pm2 ping               # Ensure pm2 daemon has been launched
pm2 sendSignal SIGUSR2 my-app # Send system signal to script
pm2 start app.js --no-daemon
pm2 start app.js --no-vizion
pm2 start app.js --no-autorestart
Posted by 비니미니파파
Framework2018. 11. 27. 18:05

환경 : eclipse + spring + mybatis 

<appender name="console" class="org.apache.log4j.ConsoleAppender">

<param name="Target" value="System.out" />

<layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss}] %-5p: %c - %m%n" />

</layout>

</appender>


[%d{yyyy-MM-dd HH:mm:ss}] 추가 

Posted by 비니미니파파
Framework2018. 11. 9. 17:11

[개발 잡담]

Exception sending context destroyed event to listener instance of class ....

Eclipse + STS 개발 중 등록한 리스너에서 말썽 이다.

짜증 나서 리스너 막고 개발 하다 이건 아닌거 같아서 구글링 해서 적용해 봐도 결국 충돌 ㅠㅠ

Tomcat 도 clean , Project 도 clean 하면 오류가 안난다.

언제 다시 날지 모르겠다. 

 

Posted by 비니미니파파
Framework2018. 10. 12. 09:28

Spring + Mybatis + Log4j 환경에서 SQL 로그 출력

환경에 따라 다를 수 있으니 참고만 하세요!

1. pom.xml

log4jdbc-remix 추가

 

2. log4j.xml 수정

~/src/main/resources/log4j.xml

    <!-- Query Loggers -->
    <logger name="jdbc.sqlonly" additivity="false"> 
        <level value="INFO"/> 
        <appender-ref ref="console"/> 
    </logger>     

    <logger name="jdbc.resultsettable" additivity="false"> 
        <level value="INFO"/> 
        <appender-ref ref="console"/> 
    </logger>

    <!-- Root Logger --> 

 

3. mybatis-context.xml 수정

<!-- Root Context: defines shared resources visible to all other web components -->
 <context:property-placeholder location="/WEB-INF/spring/mybatis/jdbc.properties" />
 <bean id ="dataSourceSpied" class= "org.springframework.jdbc.datasource.SimpleDriverDataSource" >
            <property name ="driverClass" value= "${jdbc.driverClass}"></property >
            <property name ="url" value= "${jdbc.url}" ></property >
            <property name ="username" value="${jdbc.username}"></property>
            <property name ="password" value= "${jdbc.password}"></property >

     </bean>    

     <!-- Log4JDBC 설정 -->
     <bean id="dataSource" class="net.sf.log4jdbc.Log4jdbcProxyDataSource"> 
      <constructor-arg ref="dataSourceSpied" /> 
      <property name="logFormatter"> 
      <bean class="net.sf.log4jdbc.tools.Log4JdbcCustomFormatter"> 
      <property name="loggingType" value="MULTI_LINE" /> 
      <property name="sqlPrefix" value="SQL:::" /> 
      </bean> 
      </property> 
     </bean>

Posted by 비니미니파파
  • l - length changing input control
  • f - filtering input
  • t - The table!
  • i - Table information summary
  • p - pagination control
  • r - processing display element

 

https://datatables.net/reference/option/dom

 

정리는 나중에

Posted by 비니미니파파
Server(Windows&Linux)2018. 8. 22. 14:52

1.  eGalax Touch Driver Download

http://www.eeti.com.tw/drivers_Linux.html

ubuntu 18.04 일 경우  eGTouch_v2.5.5814.L-x 파일을 다운 받는다.

2. eGTouch Install 



 ~]$ tar xvfz eGTouch_v2.5.5814.L-x.tar.g
 ~]$ cd eGTouch_v2.5.5814.L-x
 ~]$ sudo ./setup.sh

 자세한 사항은 Guide PDF 문서를 확인

3. system 등록 ( 자동 시작 )

 ~]$ sudo vi /etc/systemd/system/eGTouch.service
# eGalax Touchscreen service file
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/usr/bin/eGTouchD
DefaultDependencies=no
Before=sysinit.target
After=apparmor.service
[Service]
Type=forking
Restart=always
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
TimeoutSec=0
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=no
User=root
Group=root
ExecStart=
ExecStart=/usr/bin/eGTouchD start
ExecReload=/usr/bin/eGTouchD restart
ExecStop=/usr/bin/eGTouchD stop
[Install]
WantedBy=multi-user.target

 

 
~]$ sudo systemctl daemon-reload
~]$ sudo systemctl enable eGTouch.service
~]$ sudo systemctl restart eGTouch.service
~]$ sudo systemctl status eGTouch.service
~]$ sudo reboot

 * 재시작 후 터치스크린이 작동 한다면 성공 ! ^^

* 화면 설정 ( calibration )


     ~]$ sudo /usr/bin/eGTouchU
 

 

Posted by 비니미니파파