diff -rq todo_orig/ todo_backup/

python -c "import os,re;result=re.findall(r'[A-Z]+:.*$',os.popen('mountvol /').read(),re.MULTILINE);print ','.join(result)"


import string
from ctypes import windll

def get_drives():
    drives = []
    bitmask = windll.kernel32.GetLogicalDrives()
    for letter in string.uppercase:
        if bitmask & 1:
            drives.append(letter)
        bitmask >>= 1
    return drives

if __name__ == '__main__':
    print get_drives()     # On my PC, this prints ['A', 'C', 'D', 'F', 'H']


import os, re
re.findall(r"[A-Z]+:.*$",os.popen("mountvol /").read(),re.MULTILINE)


id oracle | sed 's/^uid=//;s/(.*$//'

#!/bin/bash


echo "SHOW SERVERS"

su - oracle -c "sqlplus '/as sysdba'" << END

set pagesize 0 feedback off ver off heading off echo off

CONN 아이디/패스워드

쿼리

exit;

END



1) Configuration of both log server and log client:

Check if there is an entry in /etc/services regarding port 514 (default for syslog).

grep 514 /etc/services

syslog 514/udp

Enable communication on this port by setting proper rule on firewall:

-A RH-Firewall-1-INPUT -p udp –dport 514 -j ACCEPT

Syslog by default is not configured to send logs to remote hosts or receive them from network. You have to change startup options in /etc/sysconfig/syslog by adding ‘-r’ to SYSLOG_OPTS.

Now we are prepared to configure syslog! Configuration is stored in /etc/syslog.conf . Entries are different on log server and log client.

2) Configuration of log server:

You have to provide information about log client and destination where logs from client will be written. To do this you have to add two lines to the /etc/syslog.conf:

+LOG_CLIENT
log_source.log_type log_file

where:

  • LOG_CLIENT could be hostname or IP adress. If you are using hostname it have to be resolved by DNS or written in /etc/hosts.
  • log_source.log_type – here you can specify subsystems from which information will be logged and message types. Here are a few examples: user.notice -> information from users; kernel.warn -> warnings from kernel; *.* -> all messages from all subsystems.
  • log_file – logs will be written here.

Example:

+log_client
user.* /var/log/log_client.log

In above example logs from user subsystem from host ‘log_client‘ will be written in /var/log/log_client.log


3) Configuration of log client:

In /etc/syslog.conf you have to specify which logs will be copied on log server:

log_source.log_type @LOG_SERVER

where:

  • log_source.log_type – here you can specify subsystems from which information will be logged and message types. Here are a few examples: user.notice -> information from users; kernel.warn -> warnings from kernel; *.* -> all messages from all subsystems.
  • LOG_SERVER could be hostname or IP adress. If you are using hostname it have to be resolved by DNS or written in /etc/hosts.

Example:

user.* @log_server

In above example logs from user subsystem will be sent to ‘log_server’ host.

Remember to restart syslog service after making any changes in /etc/syslog.conf!

service syslog restart

'서버관리' 카테고리의 다른 글

[쉘스크립트] user SID 가져오기  (0) 2013.08.13
[쉘스크립트] 쉘에서 DB 쿼리하기  (0) 2013.08.07
[LInux Connection Check]  (0) 2013.04.08
[넷백업 Active 폴리시 구하기]  (0) 2013.03.15
우분투 원격터미널 접속  (0) 2013.01.04

서버에서 다른 서버로 특정 포트로 연결이 되는지 확인하는 방법은 아래와 같이 2개가 있습니다.

아래 첫번째 방법은 리눅스에서 nc명령어로 확인하는 방법이고 밑의 두번째는 일반적으로 telnet 명령을 이용하는 방법입니다.

참고하세요.

 

nc -Z <host> <port>; echo $?

connection Success : 0 return

connection Fail : 1 return

 

echo quit | telnet 192.168.X.X 21 2>/dev/null | grep Connected

아래와 같은 명령어를 수행하면 현재 Netbackup 마스트에 있는 폴리시 중 Active되어 있는 폴리시만 출력함.

ACTIVE 1로 조회하면 De-Active되어 있는 폴리스가 조회 됨.

cd /usr/openv/netbackup/db/class

find . -name info -exec grep -l "ACTIVE 0" {} \; | cut -f2 -d"/"

sudo apt-get install xrdp

이후 mstsc에서 해당 서버 접속

ls -l / | awk '/^d/{print $NF}'

 

+ Recent posts