Raspberry Pi 3B+ 安裝 DS3231 RTC備忘

硬體
Raspberry Pi 3 Model B+
DS3231 模組

作業系統
自行編譯buildroot 2021.02

  • make raspberrypi3_64_defconfig
  • make menuconfig選擇好要安裝的程式
    • i2c-tools
  • make
  • 燒錄image至sd卡

修改config.txt <- 類似raspberrypi的bios設定
config.txt位於sdcard的第一個partition,開機進入buildroot linux後可以手動掛載此partition (/dev/mmcblk0p1)
config.txt要加入下面的資料
dtparam=i2c_arm=on

進入系統後執行下面指令

modprobe i2c-dev
modprobe i2c-bcm2835
modprobe rtc-ds1307
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device

測試

hwclock -r
hwclock -w

參考資料
https://www.taiwaniot.com.tw/product/ds3231-rtc-%E9%AB%98%E7%B2%BE%E5%BA%A6%E6%99%82%E9%90%98%E6%A8%A1%E7%B5%84-%E9%81%A9%E7%94%A8-raspberry-pi-%E6%A8%B9%E8%8E%93%E6%B4%BE%E5%85%A8%E7%B3%BB%E5%88%97%E9%96%8B%E7%99%BC%E6%9D%BF/

XenServer 6.2.0 hotfix update script

2013/12/14 update
XS62ESP1出來了
http://support.citrix.com/article/CTX139789

 

#!/bin/bash
xe patch-upload file-name=XS62E001.xsupdate
xe patch-upload file-name=XS62E002.xsupdate
xe patch-upload file-name=XS62E004.xsupdate
xe patch-upload file-name=XS62E005.xsupdate
xe patch-upload file-name=XS62E009.xsupdate
xe patch-upload file-name=XS62E011.xsupdate
xe patch-upload file-name=XS62E012.xsupdate
xe patch-pool-apply uuid=dedcc0dd-d8f3-4f76-90ca-92697c7a44f0
xe patch-pool-apply uuid=59128f15-92cd-4dd9-8fbe-a0115d1b07a2
xe patch-pool-apply uuid=5579f1f0-ff83-11e2-b778-0800200c9a66
xe patch-pool-apply uuid=aeff92a9-2c60-43eb-b34e-14e4132b411c
xe patch-pool-apply uuid=d9c753b9-a15b-4a31-897b-97fdae609031
xe patch-pool-apply uuid=ff202d2d-2812-4c6b-b500-2f4701de7bc4
xe patch-pool-apply uuid=a4251789-ce6c-4726-942c-3cddbadcaca6

 

Install VMware vSphere CLI on CentOS 6.4

Reference:

How to install VMware ESXi CLI on CentOS 6.0?

VMware vSphere 5.1 Documentation Center – vSphere 5.1 Command Line Documentation – Install vCLI

 

Install EPEL repo first

download VMware-vSphere-CLI-5.1.0-1060453.x86_64.gz from VMware website

 

yum -y install uuid-perl perl-XML-LibXML uuid-perl  libuuid-devel glibc.i686
tar zxvf VMware-vSphere-CLI-5.1.0-1060453.x86_64.gz
cd vmware-vsphere-cli-distrib
./vmware-install.pl

 

 

[temp]powercli

Connect-VIServer -Server 172.30.65.202 -User youraccount -Password 'your password'
$allvms = @()
$allhosts = @()
$hosts = Get-VMHost
$vms = Get-Vm

foreach($vmHost in $hosts){
  $hoststat = "" | Select HostName, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin
  $hoststat.HostName = $vmHost.name

  $statcpu = Get-Stat -Entity ($vmHost)-start (get-date).AddDays(-30) -Finish (Get-Date)-MaxSamples 10000 -stat cpu.usage.average
  $statmem = Get-Stat -Entity ($vmHost)-start (get-date).AddDays(-30) -Finish (Get-Date)-MaxSamples 10000 -stat mem.usage.average

  $cpu = $statcpu | Measure-Object -Property value -Average -Maximum -Minimum
  $mem = $statmem | Measure-Object -Property value -Average -Maximum -Minimum

  $hoststat.CPUMax = $cpu.Maximum
  $hoststat.CPUAvg = $cpu.Average
  $hoststat.CPUMin = $cpu.Minimum
  $hoststat.MemMax = $mem.Maximum
  $hoststat.MemAvg = $mem.Average
  $hoststat.MemMin = $mem.Minimum
  $allhosts += $hoststat
}
$allhosts | Select HostName, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin | Export-Csv "c:\Hosts.csv" -noTypeInformation

foreach($vm in $vms){
  $vmstat = "" | Select VmName, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin
  $vmstat.VmName = $vm.name

  $statcpu = Get-Stat -Entity ($vm)-start (get-date).AddDays(-30) -Finish (Get-Date)-MaxSamples 10000 -stat cpu.usage.average
  $statmem = Get-Stat -Entity ($vm)-start (get-date).AddDays(-30) -Finish (Get-Date)-MaxSamples 10000 -stat mem.usage.average

  $cpu = $statcpu | Measure-Object -Property value -Average -Maximum -Minimum
  $mem = $statmem | Measure-Object -Property value -Average -Maximum -Minimum

  $vmstat.CPUMax = $cpu.Maximum
  $vmstat.CPUAvg = $cpu.Average
  $vmstat.CPUMin = $cpu.Minimum
  $vmstat.MemMax = $mem.Maximum
  $vmstat.MemAvg = $mem.Average
  $vmstat.MemMin = $mem.Minimum
  $allvms += $vmstat
}
$allvms | Select VmName, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin | Export-Csv "c:\VMs.csv" -noTypeInformation

 

reference:  https://communities.vmware.com/thread/258250

todo: add disk i/o usage

從IP清單轉fortinet firewall語法

<?php

function gen_fw_config_mulit($IP){
  #10.28.101.135-155
  $tmp = preg_split('/\./', $IP);
  $ip_head = "{$tmp[0]}.{$tmp[1]}.{$tmp[2]}";
  $tmp2 = preg_split('/-/', $tmp[3]);
  $ip_start = $tmp2[0];
  $ip_end = $tmp2[1];

  #output config
  echo "edit \"$ip_head.[$ip_start-$ip_end]\"\n";
  echo "    set associated-interface \"P1\"\n";
  echo "    set type iprange\n";
  echo "    set end-ip $ip_head.$ip_end\n";
  echo "    set start-ip $ip_head.$ip_start\n";
  echo "next\n";
}

function gen_fw_config_single($IP){
  #10.28.101.135
  #output config
  echo "edit \"$IP/32\"\n";
  echo "    set associated-interface \"P1\"\n";
  echo "    set subnet $IP 255.255.255.255\n";
  echo "next\n";
}

?>

 

<?php

$ip_file = 'iplist.txt';

require_once 'config.inc.php';
$lines = file($ip_file);
foreach($lines as $line){
  $line = trim($line);
  if (stripos($line, '-') !== false){ //multi IP
    #echo "#$line\n";
    gen_fw_config_mulit($line);
  }else { //single IP
    gen_fw_config_single($line);
  }//if
}//foreach
?>