Backup / Senkronizasyon Programı Tavsiyesi
-
GFI backup kullanıyoruz ofiste.
-
HolyOne bunu yazdı
Senkronizasyon olayı için microsoft sync toy güzelmiş şimdi kurcaladım. iki tarafın saatleriyle fln oynadım yinede bi hata yapmadı.
Sync sorununu çok güzel çözüyor yani.
Şimdi biraz kafayı çalıştırınca anladım ki bu iş anca bat dosyasıla çözülür. çünkü çalışan sql dbleri fln da backuplamam lazım. sqli stop da etmek istemiorum ama napalim =)
rar.exe ile sqli stop etmeden backup komutlarıyla istediğin klasöre backup alabilirsin hocam.
job olarak sqlagent'e ekle.
istediğinde sağ tıklayıp çalıştırırsın.
sqlde durmaz.
-
Cobianbackup kullanıyorum oto sync de yapabileceğini düşünüyorum sadece kurucalamak gerekiyor ayarlarını. ben direk disk içeriklerini haftalık günlük senaryolarla daha güvenli disk ortamlarına taşıttırıyorum.
mesela dizine bakıyor önce dizinin tamamnyedeğini alıyor, daha sonra değişenleri
-
dosya boyutları cok degilse yandex disk güzel caısıyor
-
Evet beyler bunu sormuştum, Pratik bir çözüm bulamadım kendi yöntemlerimle çözdüm 280 satır bir powershell script yazdım.
Aşağıdaki scriptte tek değiştirmeniz gereken
$pathsve $backupdir değişkenleridir. her backuplanacak öğreye ayrı parametreler vermek işi kolaylaştırıyor.Backuplara şifre koyabilir, IIS, SQL gerektiğinde stoplayabilir, klasor yada dosya şifreleyebilirsiniz.
Aynı klasörde 7za.exe de olması gerekiyor
İşlem bitince mail de atıyor.
Belki kullanan olur
<# .SYNOPSIS Aytek Ustundag 2013 Backup Script .DESCRIPTION This script makes it easy for you to backup your folders it takes care of pre and post backup operations, compression, reporting. .NOTES File Name : Backup.ps1 Author : Aytek Ustundag ustundag@gmail.com Requires : PowerShell V2 CTP3 .LINK http://www.tahribat.com .EXAMPLE The only thing you need to modify in the script is backup destination ($backupdir) and file array ($paths) $paths = ("C:\BackupTest\excels",@{ PreExecute="dir"; postExecute="ver"}) , ("C:\BackupTest\images\",@{ CompLevel=1 ; }) #> #Folder list to backup, and parameters $paths = ("C:\BackupTest\excels",@{ PreExecute="dir"; postExecute="ver"}) , ("C:\BackupTest\images\",@{ CompLevel=3 ; <#Resimler zaten sikismis,low comression olsun #> StopSQL =0; StopIIS =1; }), #bunu arşivlemeden dilersek sqli stop ederiz (backup bitince tekrar baslar) #("G:\archive.tc",@{TruecryptMount =@{Password="xxxx"; MountDrive="Q:\" }; }), #Beta "C:\BackupTest\gurtek.pdf", #parametre vermeden sadece dosya da verebiliriz ("C:\BackupTest\New folder\gurtek2.pdf",@{ Password="hoyt" ; Prefix="2-"}) #bunun passwordu değişik olsun, ismi de öncekiyle celismesin diye basina "2-" koyalim #Backup destination $backupdir=("C:\BackupTest\Backups\{0}_{1:dd-MM-yyyy}\" -f $env:computername,(get-date)) #Archive Password $password = "" # leave empty for no password ? for ask on start #-------------Optional settings------------- $smtpSettings= @{ #Mail almak istiyorsanız bunu ayarlayın SendMailReport=$false; SmtpServer="smtp.gmail.com"; SmtpPort="587"; fromMail="Aytek Ustundag <xxx@gmail.com>" ; toMail="Aytek Ustundag <xxx@gmail.com>"; Username="********"; Password="******"; } $FTPSettings=@{ #FTP feature is still in beta phase SendToFTP=$false; FTPServer="localhost"; FTPPort="21"; Username="Admin"; Password="*******"; RemotePath= ("/{0}_{1:dd-MM-yyyy}/" -f $env:computername,(get-date)) } #--------------------------------------CODE--------------------------------------- $DefaultCompressionLevel=8 $ErrorActionPreference = "Stop" $scriptpath = Split-Path $MyInvocation.MyCommand.Path Set-Location -Path $scriptpath $StartDate = Get-Date if ( $password -eq "?"){ $password=Read-Host "Enter compression password:"} $timepostfix=("{0:dd-MM-yyyy_HH-mm-ss}" -f $StartDate) $LogFileName= "$scriptpath\Logs" if (!(Test-Path -path $LogFileName)) { New-Item $LogFileName -Type Directory | out-null} $LogFileName="$LogFileName\Log_$timepostfix.txt" Function Log([string]$logstring) { if($localecho) {echo $logstring} $datetimenow= Get-Date Add-content $LogFileName -value "$datetimenow $logstring" } Log("--------------Started backup job for $backupdir --------------------------------" ) $backupdirValid=$false; if (!(Test-Path -path $backupdir)) {New-Item $backupdir -Type Directory | out-null; $backupdirValid=$true; } else {$backupdirValid=$true;} if(!$backupdirValid) { Log("Backup destination is not valid or you dont have access.") return; } Function RunCommand ($commandline) { if( $commandline -ne "" ) { try{ [System.Collections.ArrayList] $cmdarr = $commandline.Split(' ') $cmdexecutable = $cmdarr[0].Replace("""",""); $cmdarr.RemoveAt(0); & .\$cmdexecutable $cmdarr| where {$_ -ne ""} }catch [Exception] { Log( "Error: $_.Exception.Message") } } } #----------------------------Begin Processing ------------------------------------- foreach($path in $paths) { if( $path.Count -eq 1) {$Item=$path} else{ $Item=$path[0];} #region PreOps $mssqlstopresult=-1;$sqlexpressstopresult=-1;$IISstopresult=-1; if( $path.PreExecute -ne $null -and $path.PreExecute -ne "" ) { Log("PreExecuting: $path.PreExecute") RunCommand($path.PreExecute) } if ($path.StopIIS -eq 1) { try{ Stop-Service -name w3svc -force; $IISstopresult=0; Write-Host -foregroundcolor yellow "IIS stopped" ; Log("IIS stopped" )}catch{} } if ($path.StopSQL -eq 1) { try{ Stop-Service -name MSSQLSERVER -force; $mssqlstopresult=0; Write-Host -foregroundcolor yellow "MSSQLSERVER stopped"; Log("MSSQLSERVER stopped" ) }catch{} ;try{ Stop-Service -name MSSQL*SQLEXPRESS -force; $sqlexpressstopresult=0; Write-Host -foregroundcolor yellow "MSSQLEXPRESS stopped"; Log("MSSQLEXPRESS stopped" ) }catch{} } #endregion PreOps if(test-path $Item) { $zipname=(Split-Path $Item -leaf ) if( $path.Prefix -ne $null -and $path.Prefix -ne "" ) { $zipname="$($path.Prefix)$zipname"} $zipname="$($zipname)_$timepostfix.7z" Log("Processing Item: $Item"); $CompressionLevel=$DefaultCompressionLevel if( $path.CompLevel -ne $null -and $path.CompLevel -ne "" ) {$CompressionLevel=$path.CompLevel} $pass=$password if( $path.Password -ne $null -and $path.Password -ne "" ) { if ( $path.Password -eq "?"){ $pass=Read-Host "Enter compression password for $Item :"} else { $pass=$path.Password } } $cmdtorun = """7za.exe"" a -t7z ""$backupdir$zipname"" ""$Item""" if( $pass -ne $null -and $pass -ne "" ) { $cmdtorun = $cmdtorun +" -p$pass"} $cmdtorun = $cmdtorun +" -v500m -ssw -mmt2 -mx$CompressionLevel -mhe" echo ">$cmdtorun" Set-Location -Path $scriptpath RunCommand( $cmdtorun ) # |out-null }else { Log( "File or directory ""$Item"" does not exist, skipping archiving...") } #region PostOps if ($path.StopSQL -eq 1){ if ($mssqlstopresult -eq 0) { try{ Start-Service -name MSSQLSERVER; Write-Host -foregroundcolor green "MSSQLSERVER Started"; Log("MSSQLSERVER Started" ) }catch{} } if ($sqlexpressstopresult -eq 0){try{Start-Service -name MSSQL*SQLEXPRESS; Write-Host -foregroundcolor green "SQLEXPRESS Started" ; Log("SQLEXPRESS Started" )}catch{} } } if ($path.StopIIS -eq 1) { if ($IISstopresult -eq 0) { try{ Start-Service -name w3svc; Write-Host -foregroundcolor green "IIS Started"; Log("IIS Started" ) }catch{} } } if( $path.PostExecute -ne $null -and $path.PostExecute -ne "" ) { Log("PostExecuting: $path.PostExecute") RunCommand($path.PostExecute) } #endregion PostOps } $myBackups= Get-ChildItem -Path "$backupdir\*" | where { !$_.PSIsContainer -and $_.Name -like "*$timepostfix*" } | Select -ExpandProperty FullName $EndDate=get-date $elapsedTime =$EndDate-$StartDate Remove-Variable password #bazi degiskenler arkada kalmasin Remove-Variable pass Remove-Variable paths Remove-Variable backupdir Remove-Variable cmdtorun Remove-Variable zipname Log("Backup Complete in $elapsedTime") #region SendEmail if($smtpSettings.SendMailReport) { $mailBody = "The backup operation has been successfully done! Date: $date
Backup files:
" + $myBackups+"" $subject = "Backup on $date" try{ if( ($smtpSettings.Username -ne $null -and $smtpSettings.Username -ne "" ) -or ($smtpSettings.Password -ne $null -and $smtpSettings.Password -ne "" ) ) { $secpasswd = ConvertTo-SecureString $($smtpSettings.Password) -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ( $smtpSettings.Username, $secpasswd) send-MailMessage -From $($smtpSettings.fromMail) -Subject $subject -To $($smtpSettings.toMail) -Attachments $LogFileName -Body $mailBody -BodyAsHtml -Port $($smtpSettings.SmtpPort) -Priority Normal -SmtpServer $($smtpSettings.SmtpServer) -UseSsl -Credential $mycreds }else { send-MailMessage -From $($smtpSettings.fromMail) -Subject $subject -To $($smtpSettings.toMail) -Attachments $LogFileName -Body $mailBody -BodyAsHtml -Port $($smtpSettings.SmtpPort) -Priority Normal -SmtpServer $($smtpSettings.SmtpServer) } }catch [Exception] { Log( "Mail Error: $_.Exception.Message") } } #| Test-Expression{$smtpSettings.EnableSsl} { -UseSsl} #endregion SendEmail if( $FTPSettings.SendToFtp) { $ftp ="ftp://$($FTPSettings.FTPServer)$($FTPSettings.RemotePath)" $webclient = New-Object System.Net.WebClient $webclient.Credentials = New-Object System.Net.NetworkCredential($FTPSettings.Username ,$FTPSettings.Password ) foreach($item in $myBackups){ echo "Uploading $item..." $uri = New-Object System.Uri($ftp+ [io.path]::GetFileName($item.Name) ) $webclient.UploadFile($uri, $item.FullName) } } Remove-Variable myBackups #region notes # Sisteminiz powershell dosyalarını calistirmiyorsa bunu ISE de çalıştırın # Set-ExecutionPolicy RemoteSigned #endregion notesHolyOne tarafından 04/Ağu/13 04:09 tarihinde düzenlenmiştir -
HolyOne bunu yazdı
Evet beyler bunu sormuştum, Pratik bir çözüm bulamadım kendi yöntemlerimle çözdüm 280 satır bir powershell script yazdım.
Belki kullanan olur
<# .SYNOPSIS Aytek Ustundag 2013 Backup Script .DESCRIPTION This script makes it easy for you to backup your folders it takes care of pre and post backup operations, compression, reporting. .NOTES File Name : Backup.ps1 Author : Aytek Ustundag ustundag@gmail.com Requires : PowerShell V2 CTP3 .LINK http://www.tahribat.com .EXAMPLE The only thing you need to modify in the script is backup destination ($backupdir) and file array ($paths) $paths = ("C:\BackupTest\excels",@{ PreExecute="dir"; postExecute="ver"}) , ("C:\BackupTest\images\",@{ CompLevel=1 ; }) #> #Folder list to backup, and parameters $paths = ("C:\BackupTest\excels",@{ PreExecute="dir"; postExecute="ver"}) , ("C:\BackupTest\images\",@{ CompLevel=3 ; <#Resimler zaten sikismis,low comression olsun #> StopSQL =0; StopIIS =1; }), #bunu arşivlemeden dilersek sqli stop ederiz (backup bitince tekrar baslar) #("G:\archive.tc",@{TruecryptMount =@{Password="xxxx"; MountDrive="Q:\" }; }), #Beta "C:\BackupTest\gurtek.pdf", #parametre vermeden sadece dosya da verebiliriz ("C:\BackupTest\New folder\gurtek2.pdf",@{ Password="hoyt" ; Prefix="2-"}) #bunun passwordu değişik olsun, ismi de öncekiyle celismesin diye basina "2-" koyalim #Backup destination $backupdir=("C:\BackupTest\Backups\{0}_{1:dd-MM-yyyy}\" -f $env:computername,(get-date)) #Archive Password $password = "" # leave empty for no password ? for ask on start #-------------Optional settings------------- $smtpSettings= @{ #Mail almak istiyorsanız bunu ayarlayın SendMailReport=$false; SmtpServer="smtp.gmail.com"; SmtpPort="587"; fromMail="Aytek Ustundag <xxx@gmail.com>" ; toMail="Aytek Ustundag <xxx@gmail.com>"; Username="********"; Password="******"; } $FTPSettings=@{ #FTP feature is still in beta phase SendToFTP=$false; FTPServer="localhost"; FTPPort="21"; Username="Admin"; Password="*******"; RemotePath= ("/{0}_{1:dd-MM-yyyy}/" -f $env:computername,(get-date)) } #--------------------------------------CODE--------------------------------------- $DefaultCompressionLevel=8 $ErrorActionPreference = "Stop" $scriptpath = Split-Path $MyInvocation.MyCommand.Path Set-Location -Path $scriptpath $StartDate = Get-Date if ( $password -eq "?"){ $password=Read-Host "Enter compression password:"} $timepostfix=("{0:dd-MM-yyyy_HH-mm-ss}" -f $StartDate) $LogFileName= "$scriptpath\Logs" if (!(Test-Path -path $LogFileName)) { New-Item $LogFileName -Type Directory | out-null} $LogFileName="$LogFileName\Log_$timepostfix.txt" Function Log([string]$logstring) { if($localecho) {echo $logstring} $datetimenow= Get-Date Add-content $LogFileName -value "$datetimenow $logstring" } Log("--------------Started backup job for $backupdir --------------------------------" ) $backupdirValid=$false; if (!(Test-Path -path $backupdir)) {New-Item $backupdir -Type Directory | out-null; $backupdirValid=$true; } else {$backupdirValid=$true;} if(!$backupdirValid) { Log("Backup destination is not valid or you dont have access.") return; } Function RunCommand ($commandline) { if( $commandline -ne "" ) { try{ [System.Collections.ArrayList] $cmdarr = $commandline.Split(' ') $cmdexecutable = $cmdarr[0].Replace("""",""); $cmdarr.RemoveAt(0); & .\$cmdexecutable $cmdarr| where {$_ -ne ""} }catch [Exception] { Log( "Error: $_.Exception.Message") } } } #----------------------------Begin Processing ------------------------------------- foreach($path in $paths) { if( $path.Count -eq 1) {$Item=$path} else{ $Item=$path[0];} #region PreOps $mssqlstopresult=-1;$sqlexpressstopresult=-1;$IISstopresult=-1; if( $path.PreExecute -ne $null -and $path.PreExecute -ne "" ) { Log("PreExecuting: $path.PreExecute") RunCommand($path.PreExecute) } if ($path.StopIIS -eq 1) { try{ Stop-Service -name w3svc -force; $IISstopresult=0; Write-Host -foregroundcolor yellow "IIS stopped" ; Log("IIS stopped" )}catch{} } if ($path.StopSQL -eq 1) { try{ Stop-Service -name MSSQLSERVER -force; $mssqlstopresult=0; Write-Host -foregroundcolor yellow "MSSQLSERVER stopped"; Log("MSSQLSERVER stopped" ) }catch{} ;try{ Stop-Service -name MSSQL*SQLEXPRESS -force; $sqlexpressstopresult=0; Write-Host -foregroundcolor yellow "MSSQLEXPRESS stopped"; Log("MSSQLEXPRESS stopped" ) }catch{} } #endregion PreOps if(test-path $Item) { $zipname=(Split-Path $Item -leaf ) if( $path.Prefix -ne $null -and $path.Prefix -ne "" ) { $zipname="$($path.Prefix)$zipname"} $zipname="$($zipname)_$timepostfix.7z" Log("Processing Item: $Item"); $CompressionLevel=$DefaultCompressionLevel if( $path.CompLevel -ne $null -and $path.CompLevel -ne "" ) {$CompressionLevel=$path.CompLevel} $pass=$password if( $path.Password -ne $null -and $path.Password -ne "" ) { if ( $path.Password -eq "?"){ $pass=Read-Host "Enter compression password for $Item :"} else { $pass=$path.Password } } $cmdtorun = """7za.exe"" a -t7z ""$backupdir$zipname"" ""$Item""" if( $pass -ne $null -and $pass -ne "" ) { $cmdtorun = $cmdtorun +" -p$pass"} $cmdtorun = $cmdtorun +" -v500m -ssw -mmt2 -mx$CompressionLevel -mhe" echo ">$cmdtorun" Set-Location -Path $scriptpath RunCommand( $cmdtorun ) # |out-null }else { Log( "File or directory ""$Item"" does not exist, skipping archiving...") } #region PostOps if ($path.StopSQL -eq 1){ if ($mssqlstopresult -eq 0) { try{ Start-Service -name MSSQLSERVER; Write-Host -foregroundcolor green "MSSQLSERVER Started"; Log("MSSQLSERVER Started" ) }catch{} } if ($sqlexpressstopresult -eq 0){try{Start-Service -name MSSQL*SQLEXPRESS; Write-Host -foregroundcolor green "SQLEXPRESS Started" ; Log("SQLEXPRESS Started" )}catch{} } } if ($path.StopIIS -eq 1) { if ($IISstopresult -eq 0) { try{ Start-Service -name w3svc; Write-Host -foregroundcolor green "IIS Started"; Log("IIS Started" ) }catch{} } } if( $path.PostExecute -ne $null -and $path.PostExecute -ne "" ) { Log("PostExecuting: $path.PostExecute") RunCommand($path.PostExecute) } #endregion PostOps } $myBackups= Get-ChildItem -Path "$backupdir\*" | where { !$_.PSIsContainer -and $_.Name -like "*$timepostfix*" } | Select -ExpandProperty FullName $EndDate=get-date $elapsedTime =$EndDate-$StartDate Remove-Variable password #bazi degiskenler arkada kalmasin Remove-Variable pass Remove-Variable paths Remove-Variable backupdir Remove-Variable cmdtorun Remove-Variable zipname Log("Backup Complete in $elapsedTime") #region SendEmail if($smtpSettings.SendMailReport) { $mailBody = "The backup operation has been successfully done! Date: $date
Backup files:
" + $myBackups+"" $subject = "Backup on $date" try{ if( ($smtpSettings.Username -ne $null -and $smtpSettings.Username -ne "" ) -or ($smtpSettings.Password -ne $null -and $smtpSettings.Password -ne "" ) ) { $secpasswd = ConvertTo-SecureString $($smtpSettings.Password) -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ( $smtpSettings.Username, $secpasswd) send-MailMessage -From $($smtpSettings.fromMail) -Subject $subject -To $($smtpSettings.toMail) -Attachments $LogFileName -Body $mailBody -BodyAsHtml -Port $($smtpSettings.SmtpPort) -Priority Normal -SmtpServer $($smtpSettings.SmtpServer) -UseSsl -Credential $mycreds }else { send-MailMessage -From $($smtpSettings.fromMail) -Subject $subject -To $($smtpSettings.toMail) -Attachments $LogFileName -Body $mailBody -BodyAsHtml -Port $($smtpSettings.SmtpPort) -Priority Normal -SmtpServer $($smtpSettings.SmtpServer) } }catch [Exception] { Log( "Mail Error: $_.Exception.Message") } } #| Test-Expression{$smtpSettings.EnableSsl} { -UseSsl} #endregion SendEmail if( $FTPSettings.SendToFtp) { $ftp ="ftp://$($FTPSettings.FTPServer)$($FTPSettings.RemotePath)" $webclient = New-Object System.Net.WebClient $webclient.Credentials = New-Object System.Net.NetworkCredential($FTPSettings.Username ,$FTPSettings.Password ) foreach($item in $myBackups){ echo "Uploading $item..." $uri = New-Object System.Uri($ftp+ [io.path]::GetFileName($item.Name) ) $webclient.UploadFile($uri, $item.FullName) } } Remove-Variable myBackups #region notes # Sisteminiz powershell dosyalarını calistirmiyorsa bunu ISE de çalıştırın # Set-ExecutionPolicy RemoteSigned #endregion notesya sen nasıl bir insansın ben hiç anlamadım cidden
-
her eve lazım valla :d
Şeyh' deki bilginin %25' i bende olsa keşke :d
ruhi tarafından 04/Ağu/13 04:10 tarihinde düzenlenmiştir -
=) Hocam bilgiden çok azim diyelim. post ettigims saati de dikkate alırsanız =)
-
HolyOne bunu yazdı
=) Hocam bilgiden çok azim diyelim. post ettigims saati de dikkate alırsanız =)
04:04 uykudan tasarruf mu denir uykudan fedakarlıkmı denır :)
heyyyy çok janjanlı :)))
Valla php ve html merakı başladı bende. Bir süre sonra öğrenicem bende olmuyor böyle :))
ruhi tarafından 04/Ağu/13 04:17 tarihinde düzenlenmiştir -
HolyOne bunu yazdı
=) Hocam bilgiden çok azim diyelim. post ettigims saati de dikkate alırsanız =)
açık konuşayım evine 6 yaşında pc gelmiş taaa ne zamanlar hemde böyle olman gayet doğal
