My Writings. My Thoughts.

Qu’ils sont forts chez MS :-) …

// janvier 14th, 2010 // No Comments » // Non classé

Qu’ils sont forts chez MS :-) http://bit.ly/51YvWk

Richard Stallman a Grenoble: h…

// janvier 14th, 2010 // No Comments » // Non classé

Richard Stallman a Grenoble: http://bit.ly/5vnxTa

Pacticing the Dojo Framework f…

// janvier 12th, 2010 // No Comments » // Non classé

Pacticing the Dojo Framework for fun and profit !

Working on a replication syste…

// janvier 4th, 2010 // No Comments » // Non classé

Working on a replication system for cinemas theaters.

Stat des tables Mysql 5>

// novembre 27th, 2009 // No Comments » // MySQL

SELECT concat(table_schema,'.',table_name),\
concat(round(table_rows/1000000,2),'M') rows,\
concat(round(data_length/(1024*1024*1024),2),'G') DATA,\
concat(round(index_length/(1024*1024*1024),2),'G') idx,\
concat(round((data_length+index_length)/(1024*1024*1024),2),'G') total_size,\
round(index_length/data_length,2) idxfrac \
FROM information_schema.TABLES \
ORDER BY data_length+index_length \
DESC LIMIT 10;

Histoire de…

// novembre 12th, 2009 // No Comments » // Pense-bete

…noter quelque chose

Supprimer les fichiers de plus de 5 jours:

find /var/ftp/* -mtime +5 -type f -exec rm {} \;

Tuer un process particulier:

ps aux | awk '$0~/Nom_du_process/&&$0!~/awk/{print $2}' | xargs kill

Voir la memoire utilisée par un user particulier:

ps auxU maxwell | awk '{memory +=$4}; END {print memory }'

Voir la gateway:

ip route show 0.0.0.0/0 | awk '{print $3}'

Lister les fichiers par ordre décroissant de taille:

 du -k * | sort -nr | cut -f2 | xargs -d '\n' du -sh

Exporter la GAL exch2007 en powershell

Get-Recipient | Select-Object Name, PrimarySmtpAddress | Export-CSV -Encoding Unicode c:\recipients.csv

Une tite manip pour ajouter un serveur dans la conf de l’agent zabbix sous Debian

find /etc/init.d/ -type f -name zabbix* -exec {} stop \;
sed -i 's/Server=a.b.c.d/Server=a.b.c.d,e.f.g.h/g' /etc/zabbix/zabbix_agentd.conf
find /etc/init.d/ -type f -name zabbix* -exec {} start \;

Supprimer les profils en vbscript

// octobre 17th, 2009 // No Comments » // Non classé, VBScript

Option Explicit
On Error Resume Next

Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems
Dim strMessage
Dim deleteResponse

strComputer = ""
UserName = ""
Password = ""
strMessage = ""

strComputer = InputBox("Please enter the FQDN of the new computer:")

If strComputer = "" Then
    WScript.quit
End If

If Not Ping (strComputer) Then
    MsgBox "The computer (" + strComputer + ") is not responding to ping - exiting"
    WScript.quit
End if

Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_UserProfile",,48)
For Each objItem in colItems
    strMessage = ""
    If not objItem.LastDownloadTime = "" Then
        strMessage = strMessage + "LastDownloadTime: " & left(objItem.LastDownloadTime,8) + Chr(10) + Chr(13)
    End If

    If Not objItem.LastUploadTime = "" Then
        strMessage = strMessage + "LastUploadTime: " & left(objItem.LastUploadTime,8) + Chr(10) + Chr(13)
    End if

    if not objItem.LastUseTime = "" then
        strMessage = strMessage + "LastUseTime: " & left(objItem.LastUseTime,8) + Chr(10) + Chr(13)
    End If

    If Not objItem.Loaded  = "" Then
        strMessage = strMessage + "Loaded: " & objItem.Loaded + Chr(10) + Chr(13)
    End If

    If not objItem.LocalPath = "" then
        strMessage = strMessage + "LocalPath: " & objItem.LocalPath + Chr(10) + Chr(13)
    End If

    if not objItem.RefCount = "" then
        strMessage = strMessage + "RefCount: " & objItem.RefCount + Chr(10) + Chr(13)
    End If

    if not objItem.RoamingConfigured = "" then
        strMessage = strMessage + "RoamingConfigured: " & objItem.RoamingConfigured + Chr(10) + Chr(13)
    End If

    if not objItem.RoamingPath = "" then
        strMessage = strMessage + "RoamingPath: " & objItem.RoamingPath + Chr(10) + Chr(13)
    End If

    if not objItem.RoamingPreference = "" then
        strMessage = strMessage + "RoamingPreference: " & objItem.RoamingPreference + Chr(10) + Chr(13)
    End If

    if not objItem.SID = "" then
        strMessage = strMessage + "SID: " & objItem.SID + Chr(10) + Chr(13)
    End If

    if not objItem.Special = "" then
        strMessage = strMessage + "Special: " & objItem.Special + Chr(10) + Chr(13)
    End If

    if not objItem.Status = "" then
        strMessage = strMessage + "Status: " & objItem.Status + Chr(10) + Chr(13)
    End If

    strMessage = strMessage + Chr(10) + Chr(13) + Chr(10) + Chr(13) + "Do you wish to delete this profile?"

    deleteResponse = MsgBox (strMessage,35,"Profile Found")

    Select Case deleteResponse
        Case 6
                Err.Clear
                objItem.Delete_
                If Err.Number = 0 Then
                        MsgBox("Profile " & objitem.localpath & " on " & strComputer & " deleted")
                Else
                        MsgBox("Profile " & objitem.localpath & " on " & strComputer & " NOT deleted - Is user logged in?")
                End If
    End Select

Next

Function Ping(strHost)

    dim objPing, objRetStatus

    set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
      ("select * from Win32_PingStatus where address = '" & strHost & "'")

    for each objRetStatus in objPing
        if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
                Ping = False
        else
            Ping = True
        end if
    Next
End Function

Supprimer les fichiers de plus de 5 jours

// octobre 17th, 2009 // No Comments » // VBScript

Dim Fso, Directory, Modified, Files
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Directory = Fso.GetFolder("rep_a_traiter")
Set Files = Directory.Files

For Each Modified in Files
   If DateDiff("D", Modified.DateLastModified, Now) >= 5 Then Modified.Delete
Next

Script de gestion d’un service en Batch

// août 3rd, 2009 // No Comments » // Non classé

:: Script pour simplier le demarrage et l'arret du service SRVC_XXX

@echo off

echo ----------------------------------------
echo !     SRVC_XXX service management     !
echo ---------------------------------------- 

net start | find "SRVC_XXX" >nul 2>nul
if /i "%errorlevel%"=="0" echo SRVC_XXX is running
if /i "%errorlevel%"=="1" echo SRVC_XXX is not running

:help
echo.
echo Type "start" to start the service
echo Type "stop" to stop the service
echo Type "exit" to quit this script
echo type "help" to get this help
echo.

:start
set /p _reponse="> "
if /i "%_reponse%"=="exit" goto end
if /i "%_reponse%"=="start" goto start_SRVC_XXX
if /i "%_reponse%"=="stop" goto stop_SRVC_XXX
if /i "%_reponse%"=="help" goto help
goto start

:check
net start | find "SRVC_XXX" >nul 2>nul
if /i "%errorlevel%"=="0" goto success
if /i "%errorlevel%"=="1" goto failure

:start_SRVC_XXX
net start "SRVC_XXX" >nul 2>nul
goto check

:stop_SRVC_XXX
net stop "SRVC_XXX" >nul 2>nul
goto check

:success
echo SRVC_XXX is running
echo.
goto start

:failure
echo SRVC_XXX is not running
echo.
goto start

:end
echo Bye.
echo.

set _string=
set _result=

Zabbix 1.6.4 sur OpenBSD 4.5

// juillet 31st, 2009 // No Comments » // Monitoring, OpenBSD

Vous trouverez ci joint un howto sur l’install de Zabbix sur OpenBSD y abordant également la sécurisation de l’accès à la console de monitoring.

Installation Zabbix 1.6.4 sur OpenBSD 4.5