Windows 2008 de internete çıkış ip problemi

Ocak 31, 2012 by · 1 Comment 

Windows 2008 den önceki sunucu işletim sistemlerinde interface ‘ e eklediğiniz ilk ipden internete çıkardı. Windows 2008 de bunu makinedeki en küçük ipden internete çıkacak şekilde değiştirdiler. Detay için http://support.microsoft.com/kb/2386184/ adresini inceleye bilirsiniz.

Çözüm olarak ip adresini eklerken, ip adresini kaynak ipisi olarak kullanma şeklinde işaretlemektir.

Kaynak ipisi olarak bu ipadresini kullanma bayrağı ile eklemek için

Netsh int ipv4 add address <Interface Name> <ip address> skipassource=true

Örnek olarak

netsh int ipv4 add address "Local Area Connection" 1.1.1.1 255.255.255.0 skipassource=true

İşaretli ipileri görmek için

Netsh int ipv4 show ipaddresses level=verbose

Too many open files: apr_socket_accept:

Kasım 30, 2011 by · Leave a Comment 

(24)Too many open files: apr_socket_accept: hatasının çözümü

apache2 servis daemon acıyoruz;
debian tabanlı linux ler için

nano /etc/init.d/apache2

redhat tabanlı linuxler için

nano /etc/init.d/httpd

sayfanın en üstüne

ulimit -n 65535

yazıp kaydediyoruz. Apache yi restart ettiğiniz zaman apache servisiniz normale dönecektir.
debian tabanlı linux ler için

/etc/init.d/apache2 restart

redhat tabanlı linuxler için

/etc/init.d/httpd restart

Python ile dosya replace

Kasım 29, 2011 by · Leave a Comment 

php dosylarındaki mysql server ip adresini değiştirmek için kullanmıştım.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import fileinput, string, sys,os
Maindir = "/var/vhost"
OldIP = "123123"
NewIP = "345345"
LogFilePath = "test.log"
def replacemachine(fileName):
    ##################################################################
    file = open(fileName, "r") #Opens the file in read-mode
    text = file.read() #Reads the file and assigns the value to a variable
    file.close() #Closes the file (read session)
    file = open(fileName, "w") #Opens the file again, this time in write-mode
    file.write(text.replace(OldIP, NewIP)) #replaces all instances of our keyword
    # and writes the whole output when done, wiping over the old contents of the file
    file.close() #Closes the file (write session)
    logactions(fileName)
    ##################################################################
def listdir(ParentPath):    
    for f in os.listdir(ParentPath):
        if os.path.isfile(os.path.join(ParentPath,f)):
            if f.rfind(".php") > 0:
                print("file being replaced:",os.path.join(ParentPath,f))
                replacemachine(os.path.join(ParentPath,f))
                print("file replaced:",os.path.join(ParentPath,f))
        else:
            #print("directory:",f)
            listdir(os.path.join(ParentPath,f))
def logactions(FileName):
    LogStr = FileName + " replace edildi\n"
    LogFile = open(LogFilePath,"a")
    LogFile.write(LogStr)
if __name__ == "__main__":
    listdir(Maindir)

netscaler ‘ a yeni sata disk takmak

Kasım 28, 2011 by · Leave a Comment 

Diyelim ki netscalerinizin sata diski bozuldu yeni bir disk taktınız. Taktığınız sistemin netscalerın anlayacağı şekle çevirmek çevirmek için

netscaler ‘ a login olun
Login olduktan sonra shell ‘ e düşün

> shell
Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.

/flash/.recovery klasörüne giriyoruz

[email protected] cd /flash/.recovery

/flash/.recovery klasörüne içine bakalım

[email protected] /flash/.recovery# ls -la
total 66572
drwxrwxrwx  5 root  wheel       512 Jun  4  2007 .
drwxr-xr-x  6 root  wheel       512 Nov 18 20:33 ..
drwxrwxrwx  2 root  wheel       512 May  1  2007 Xad2
drwxrwxrwx  2 root  wheel       512 May  1  2007 Xflash
drwxrwxrwx  2 root  wheel       512 May  1  2007 boot
-rw-rw-rw-  1 root  wheel  68088012 May  1  2007 hd.recovery.tgz
-rw-rw-rw-  1 root  wheel      4380 May  1  2007 rc.flash
-rw-rw-rw-  1 root  wheel      3055 May  1  2007 rc.manufacture
-rw-rw-rw-  1 root  wheel      6143 May  1  2007 rc.recovery
-rw-r--r--  1 root  wheel      1122 Nov 18 20:31 recovery.log
Manufacturing ad2 for 1200210 started at Mon Jun  4 17:05:32 GMT 2007

rc.recovery dosyasını çalışıtıyoruz.

[email protected] /flash/.recovery# sh rc.recovery  
Recovery requested for disk ad2, system 940030
Attention! Attempt to 'recover' mounted disk ad2!
Please unmount the disk manually and then type 'exit'!
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/md0c      155M    145M    6.3M    96%    /
devfs          1.0K    1.0K      0B   100%    /dev
procfs         4.0K    4.0K      0B   100%    /proc
/dev/ad0s1a    226M    192M     16M    92%    /flash
/dev/ad2s1e     66G    749M     60G     1%    /var
Unmount ad2>

ad2 diskini seçtiğimizde taktığımız diske formatlayıp eksik dosyaları atacaktır.

Recovery ad2 for 1200210 started at Mon Jun  4 17:05:32 GMT 2007
1+0 records in
1+0 records out
512 bytes transferred in 0.000106 secs (4825806 bytes/sec)
fdisk: WARNING line 2: number of cylinders (9964) may be out-of-range
    (must be within 1-1024 for normal BIOS operation, unless the entire disk
    is dedicated to FreeBSD)
New filesystems have been created
Using /flash/.recovery/hd.recovery.tgz for ad2s1e data recovery
/dev/ad2s1e    66G    68M    61G     0%    /var
/dev/ad2s1a  1004M   126M   798M    14%    /mnt
 
Recovery ad2 for 940030 started at Fri Nov 18 10:30:10 PST 2011
1+0 records in
1+0 records out
512 bytes transferred in 0.000431 secs (1187768 bytes/sec)
 
fdisk: WARNING line 2: number of cylinders (9964) may be out-of-range
    (must be within 1-1024 for normal BIOS operation, unless the entire disk
    is dedicated to FreeBSD)
New filesystems have been created
Using /flash/.recovery/hd.recovery.tgz for ad2s1e data recovery
/dev/ad2s1e    66G    69M    61G     0%    /var
/dev/ad2s1a  1004M   128M   796M    14%    /mnt

windows icin üretilmiş ssl li linux e çevirmek

Kasım 28, 2011 by · Leave a Comment 

İlk önce issimizden ssl i .pfx olarak export ediyoruz. http://www.slproweb.com/products/Win32OpenSSL.html adresinden makinemize open ssl kuruyoruz.

Sertifikasiz bir şekilde .pem formatına dönüştürüyoruz.

openssl.exe pkcs12 -in publicAndprivate.pfx -nocerts -out privateKey.pem

sertifikayı alıyoru

openssl.exe pkcs12 -in publicAndprivate.pfx -clcerts -nokeys -out publicCert.pem

.pem dosyasını rsa ‘ ya çeviriyoruz ve şifreden kuruluyor.

openssl.exe rsa -in privateKey.pem -out private.pem

20 saniyede 1 cron çalıştırmak

Kasım 28, 2011 by · Leave a Comment 

Linux de crontab ‘ ın servisi cronda iş varmı kontrolunu 1 dakika aralıkla yapmaktadır. Diyelim ki 1 dakikadan daha kısa sürede cron çalıştırmak istiyorsak bunu 2 tane yolu mevcuttur.
1. yol sleep ile crondaki işlemi uyutmak

*/1 * * * * /home/script
*/1 * * * * sleep 20 && /home/script
*/1 * * * * sleep 40 && /home/script

2. yol bash script yazmak.

#!/bin/bash
while true
do /home/script
sleep 20
done