RedPlug's Tory



1. 터미널 실행


2-1. 독 막대 초기화

defaults delete com.apple.dock;killall Dock 


2-2. 런치패드 초기화

defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock 



출처 : http://macnews.tistory.com/2774


Java7 설치한 상태에서 iDRAC Console 접근 시 manifest관련 메세지와 함께 

"응용 프로그램 오류" 메세지가 발생하면서 접근이 불가한 경우


Java 제어판 > 보안 > 사이트 목록 편집으로 예외 사이트 항목으로 지정해주면, 

정상적으로 접근이 가능함.





Windows DHCP Server의 경우 일단위로 Log 파일이 생성되며, 요일단위로 순환로깅이 적용되어 있습니다.

일단위로 생성되는 로그 파일을 장기간 보관(하기 설정은 1년간 보관)을 위하여  만든(짜집기+수정) 스크립트이며,

해당 스크립트를 일단위로 예약작업 걸어주시면 되겠습니다.

로그 생성하는 부분까지는 Powershell 2.0에서도 정상적으로 작동 합니다만

삭제 하는 부분은 where을 정상적으로 인식하지 못해서 작동하지 않으니 참고하시면 되겠습니다.

감사합니다.

dhcplogbackup.zip


DHCP Log Backup Script

 
### It is only available in PowerShell 3.0 or later ###

## DHCP Log Remote Backup ##

#----- define parameters -----#

#----- Get Yestedays Date In Month, Day, Year format -----#
$yesterday=(get-date (get-date).AddDays(-1) -uformat %Y%m%d)

#----- Get the first 3 letters of the day name from yesterday -----#
$logdate=([string]((get-date).AddDays(-1).DayofWeek)).substring(0,3)

#----- Remote Backup Location -----#
$BackupLocation="백업 위치 지정"

#----- Change path to DHCP log folder, copy yesterdays log file to backup location -----#
cd C:\Windows\System32\dhcp
copy "DhcpSrvLog-$logdate.log" $BackupLocation
 
#----- Rename log file with yesterdays date -----#
cd $BackupLocation
rename-item "DhcpSrvLog-$logdate.log" "$yesterday.log"
 
#----- Dump DHCP database -----#
$today=(get-date -uformat %Y%m%d)
$dumpfile="DHCP_DUMP-$today.txt"
netsh dhcp server dump > $BackupLocation$dumpfile

## DHCP Old Log Delete ##

#----- define parameters -----#

#----- get current date ----#
$Now = Get-Date

#----- define amount of days ----#
$Days = "365"

#----- define extension ----#
$Extension = "*.*"

#----- define LastWriteTime parameter based on $Days ---#
$LastWrite = $Now.AddDays(-$Days)

#----- get files based on lastwrite filter and specified folder ---#
$Files = Get-Childitem $BackupLocation -Include $Extension -Recurse | Where {$_.LastWriteTime -le "$LastWrite"}

foreach ($File in $Files)
    {
    if ($File -ne $NULL)
        {
        write-host "Deleting File $File" -ForegroundColor "DarkRed"
        Remove-Item $File.FullName | out-null
        }
    else
        {
        Write-Host "No more files to delete!" -foregroundcolor "Green"
        }
    }





- 실행(윈도우키 + R) > Regedit 실행

- HKEY_CURRENT_USER/Control Panel/Desktop/WindowMetrics > BorderWidth, PaddedBorderWidth 0으로 변경 > 재부팅

   

- 재 부팅 후 변경 확인

윈도우 8.1이 갑자기 써보고 싶어서 설치 프로그램 listup 하려고 보니 생각보다 프로그램이 많은 상태라

별도로 Output 하는 방법을 찾아보기 시작, 서드파티프로그램은 설치 해야 하는 번거로움이 있어서

윈도우 자체에서 할 수 있는 방법을 찾아보니 WMIC를 이용한 방법이 있네요.


재설치 시 참고 하시면 되겠습니다.


 1. 관리자 모드로  cmd(커맨드창) 열기


 2. wmic


 3. /output:c:\programlist.txt product get installdate,name,vendor,version


 (상기와 같이 C드라이브 루트로 파일 저장하는 경우 관리자로 열지 않으면 저장이 안될수도 있음.)


 4. exit 


 5. output 파일 필요한 경우 백업


 6. End.


@ 설치된 업데이트 리스트 추출을 하려면 상기 3번에서 하기와 같이 입력해주시면 됩니다.

   /output:c:\updatelist.txt QFE get Caption, Description, HotFixID, InstalledOn



# 참고 사이트

 http://dochi575.egloos.com/viewer/4791023




CentOS DNS 설정 변경

Linux2014. 7. 20. 19:48

CentOS 6.5 기준으로 작성되었습니다.


공유기 설정 (IPTIME 기준)

공유기 환경 내 구축된 서버이기 때문에 외부와의 통신을 위하여 포트포워딩 설정이 필요합니다. 

(DNS는 TCP/UDP 53 Port를 사용)


방화벽 ACL Open

# iptables -A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
# iptables -A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
# service iptables save
# service iptables restart 



DNS 설치

 # yum -y install bind-*


DNS서버 설치 확인

[root@reds-cent ~]# rpm -qa | grep bind
bind-utils-9.8.2-0.23.rc1.el6_5.1.x86_64
bind-sdb-9.8.2-0.23.rc1.el6_5.1.x86_64
bind-chroot-9.8.2-0.23.rc1.el6_5.1.x86_64
bind-devel-9.8.2-0.23.rc1.el6_5.1.x86_64
samba-winbind-clients-3.6.9-169.el6_5.x86_64
samba-winbind-3.6.9-169.el6_5.x86_64
ypbind-1.20.4-30.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
bind-libs-9.8.2-0.23.rc1.el6_5.1.x86_64
bind-9.8.2-0.23.rc1.el6_5.1.x86_64
bind-dyndb-ldap-2.3-5.el6.x86_64
[root@reds-cent ~]#



DNS 설정

named.conf 수정

# vi /etc/named.conf


//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {

// 주석처리

//      listen-on port 53 { 127.0.0.1; };

// listen에 대 any로 Open

        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";

// 주석처리

//      allow-query     { localhost; };

// 네임서버 쿼리를 허용할 IP 설정

        allow-query     { any; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";



named.rfc1912.zones 수정

[root@reds-cent ~]# vi /etc/named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

zone "localhost.localdomain" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};

zone "localhost" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};

zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.loopback";
        allow-update { none; };
};

zone "1.0.0.127.in-addr.arpa" IN {
        type master;
        file "named.loopback";
        allow-update { none; };
};

zone "0.in-addr.arpa" IN {
        type master;
        file "named.empty";
        allow-update { none; };
};
// flgram.com 에 대한 도메인 추가

// flgram.com Domain

zone "flgram.com" IN {
        type master;
        file "flgram.com.zone";
        allow-update { none; };



zone "225.121.210.in-addr.arpa" IN {
        type master;
        file "flgram.com.rev";
        allow-update {none; };
};

 


zone 파일 생성 시 named.localhost 파일을 복사해서 사용, 및 소유권 정정

# cp /var/named/named.localhost /var/named/flgram.com.zone
# cp /var/named/named.localhost /var/named/flgram.com.rev

# chown root.named /var/named/flgram.com.zone
# chown root.named /var/named/flgram.com.rev


flgram.com zone파일 생성

[root@reds-cent ~]# vi /var/named/flgram.com.zone
//flgram.com.zone
$TTL 10M
@       IN SOA ns1.flgram.com. webmaster.flgram.com. (
                                20140720
                                1D
                                1H
                                1W
                                3H )
        IN      NS      ns1.flgram.com.
        IN      MX      10 mail.flgram.com.
        IN      A       210.121.225.137
ns1     IN      A       210.121.225.137
www     IN      A       210.121.225.137
blog    IN      A       110.45.229.135
flgram.com. IN TXT "v=spf1 ip4:210.121.225.137 ~all" 


flgram.com rev파일 생성(수정)

[root@reds-cent ~]# vi /var/named/flgram.com.rev

// flgram.com.rev
$TTL 10M
@       IN SOA ns1.flgram.com. webmaster.flgram.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        IN      NS      ns1.flgram.com
00      IN      PTR     ns1.flgram.com
00      IN      PTR     mail.flgram.com
 






안녕하세요 Redplug 입니다.


Cacti에서 추가 된 Cisco Switch Interface Graph 확인 시 제목란에 Description에 대한 부분이 노출이 되지 않습니다.

Interface 구분 시 개인적으로는 Switch에 Description을 을 자주 넣어주는 편이어서 노출이 되지 않으니 좀 불편한 감이 있더군요.



Description을 자동적으로 추가하고 싶을 때는

Console > Graph Management > 수정할 Graph 선택 > Title(--title)란 에 |query_ifAlias| 추가 해주시면 됩니다.



추가 시 하기와 같이 표기됩니다.


다수의 스위치를 관리하시는게 아니라면 텍스트로 추가하셔도됩니다.


감사합니다.


Exchange 서버 운영 명령어 (Exchange 2010 기준)



 Mailbox Database Size Check

 Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize

 White Space Size Check

 Get-MailboxDatabase -Status | Select-Object server,Name, availablenewmailboxspace,DatabaseSize

 Mail Indexing Service test

 Get-mailboxdatabase | test-exchangesearch



ADUserDisplayNameADD.ps1



##ActiveDirectory 모듈 추가

Import-Module ActiveDirectory


##변경할 위치 지정(OU)

$SearchBase = "OU=Users,OU=TEST,DC=reds,DC=com"


##추가할 문구 지정

$Last = "(테스트)"


##정보값 불러오기

$Users = Get-ADuser -filter * -SearchBase $SearchBase -Properties Surname, GivenName, DisplayName, Name



##DisplayName 추가 작업

foreach ($user in $Users)

{


  $Surname = (Get-ADUser $user | foreach { $_.Surname})

  $GivenName = (Get-ADUser $user | foreach { $_.GivenName}) + $Last

  $DisplayName = $Surname + $GivenName

  $Name = (Get-ADUser $user | foreach { $_.Name})

Set-aduser -Identity $Name -GivenName $GivenName -DisplayName $DisplayName

} 




IIS_Log_Drop.vbs


해당 스크립트 파일을 윈도우 작업 스케줄러의 기본작업 만들기로 등록 하시면 사용이 가능합니다.


삭제할 파일이 들어있는 디렉토리와 삭제 일자를 는 상황에 따라 변경해주시면 되며, 

응용하시면 IIS뿐만아니라 다른 용도로도 사용이 가능합니다.



 VBS Script

Option Explicit

Const strRootPath = "C:\inetpub\logs\LogFiles\W3SVC1\" ' 삭제할 파일이 들어 있는 디렉토리

Const nDays = 7 '초과일수 : 7일 경과한 파일 삭제


Dim oFSO

Set oFSO = CreateObject("Scripting.FileSystemObject")


Dim oFolder, oSubFolder

Set oFolder = oFSO.GetFolder(strRootPath)


Dim oFile


' 지정한 루트 디렉토리의 파일 삭제

For Each oFile In oFolder.Files

If Int(Now() - oFile.DateLastModified) >= nDays Then

' WScript.Echo oFile.Name  & " Deleting"

oFile.Delete

End If

Next


' 지정한 루트 디렉토리에 포함된 서브 디렉토리의 파일 삭제

For Each oSubFolder In oFolder.SubFolders

WScript.Echo oFolder.name & " ??"

For Each oFile In oSubFolder.Files

If Int(Now() - oFile.DateLastAccessed) >= nDays Then

oFile.Delete

WScript.Echo oFile.Name  & " 'Deleted'"

End If

Next

Next