修復VCenter Log Disk Exhaustion on vc 錯誤

參考: https://kb.vmware.com/s/article/2143565

輔助指令

df -h |awk '0+$5 >= 78 {print}'
du --max-depth=1 | sort -n -r  | head -n 20

修復指令

cp /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.xml /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.bak
sed -i 's/size=\"50 MB\"/size=\"10 MB\"/g' /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.xml
sed -i 's/max=\"10\"/max=\"3\"/g' /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.xml

cd /storage/log/vmware/sso/

rm localhost_access_log.*
rm vmware-identity-sts.*
rm vmware-identity-sts-perf.*
rm *2020*
rm *2021*

service vmware-stsd restart

git 範例

git 分支, 合併, tag 之範例

# 建立 develop branch
git branch develop
git checkout develop
git branch

for t in {1..5};
do
  TAG=v0.${t}
  FEATURE=feature/${TAG}

  # 建立 feature branch
  git branch ${FEATURE}
  git checkout ${FEATURE}
  git branch

  # commit 5個版本
  for i in {1..5};
  do
    data=$(printf "${FEATURE}-%03d" $i)
    echo $data >> history.txt
    history=$(cat history.txt)
    printf "# Test\n## Version\n${data}\n## History\n\`\`\`\n${history}\n\`\`\`\n" > readme.md
    git add .
    git commit -m "version: ${data}"
    git push -u origin ${FEATURE}
  done
  git branch

  # 切換develop
  git checkout develop
  git branch

  # 合併
  git merge --no-ff -m "合併(from ${FEATURE} to develop)" ${FEATURE}
  git push -u origin develop

  # 刪除分支
  git branch -d ${FEATURE}
  git push -u origin :${FEATURE}
  git push -u origin develop

  # 切換到master
  git checkout master
  git branch

  # 合併
  git merge --no-ff -m "合併(from 合併 to master)" develop
  git push -u origin master

  # 建立release
  git tag ${TAG}
  git tag -l
  git push origin ${TAG}
done

透過run-avrdude燒錄Arduino Yun

由於不小心在上一支程式用太多記憶體(接近99%)
造成Arduino Yun無法透過IDE Upload程式了
原本打算用 Arduino as ISP方式用另外一台Arduino Yun來燒錄.
但是試不出來.

後來在論壇上( https://forum.arduino.cc/index.php?topic=355657.0 )看到可以用run-avrdude來進行燒錄
因此就先用Blink建立最簡單的hex後,
再把檔案傳到Arduino上.
接著ssh進去yun後,透過下列指令進行燒錄

merge-sketch-with-bootloader.lua Blink.ino.hex
run-avrdude Blink.ino.hex

如果只是單純使用run-avrdude,也是可以燒錄.
但是IDE依然無法燒錄.
後來用merge-sketch-with-bootloader.lua對hex檔案天加入了bootloader後.
就可以讓IDE燒錄了.

gitlab runner 500錯誤

解決辦法1

gitlab-rails console
Ci::Runner.all.update_all(token_encrypted: nil)

並重啟gitlab

解決辦法2

gitlab-rails dbconsole
gitlabhq_production=> UPDATE projects SET runners_token = null, runners_token_encrypted = null;
gitlabhq_production=> UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
gitlabhq_production=> UPDATE application_settings SET runners_registration_token_encrypted = null;

並重啟gitlab

reference

https://blog.csdn.net/qq_15904277/article/details/90751271

centsos 基本安裝參考指令

#更新
yum update -y && yum autoremove -y

#安裝常用工具,如vim/wget/openssh-server/nslookup/ping/ifconfig
yum install -y git vim wget openssh* nfs-utils nfs-utils-lib open-vm-tools net-tools bind-utils iputils yum-utils

#設定ssh
mkdir -p ~/.ssh
cat <<EOF > ~/.ssh/config
Host *
    StrictHostKeyChecking no
EOF

#關閉swap
SWAPLINE=$(cat /etc/fstab | grep swap | awk '{print $1}' | sed 's/\//\\\//g')
sed -i "s/$SWAPLINE/#$SWAPLINE/g" /etc/fstab 
swapoff -a
free -m

#關閉SELINUX
setenforce 0
sed -i s/^SELINUX=.*$/SELINUX=disabled/ /etc/selinux/config
systemctl disable firewalld.service
systemctl disable libvirtd.service

#Forward Policy
iptables -P FORWARD ACCEPT

#關閉防火牆
iptables -P FORWARD ACCEPT
systemctl stop firewalld
systemctl disable firewalld

#NTP校時
yum install ntp ntpdate ntp-doc -y
cat > /etc/ntp.conf  <<EOL
restrict 127.0.0.1
restrict ::1
server time.stdtime.gov.tw  minpoll 1 maxpoll 3
server tock.stdtime.gov.tw  minpoll 2 maxpoll 3
server watch.stdtime.gov.tw minpoll 3 maxpoll 4
server clock.stdtime.gov.tw minpoll 4 maxpoll 5
server tick.stdtime.gov.tw  minpoll 5 maxpoll 6
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
EOL

systemctl stop ntpd
ntpdate time.stdtime.gov.tw
systemctl enable ntpd
systemctl start ntpd
ntpq -p

chmod 設定權限

設定test資料夾下的所有檔案權限

find test -type f -exec chmod 644 {} +

設定test資料夾下的所有資料夾權限

find test -type d -exec chmod 755 {} +

Ubuntu 16.04 架設HylaFAX筆記

1.首先需要一個USB Modem以及一台Ubuntu(這邊是在iMac下用Parallels Desktop跑Ubuntu 16.04)

2.設定ttyACM相關權限
編輯udev

sudo vim /etc/udev/rules.d/70-ttyusb.rules

加入下面設定:

KERNEL=="ttyUSB[0-9]*",MODE="0666"
KERNEL=="ttyACM[0-9]*",MODE="0666"

以及透過chmod修改權限

sudo chmod o+rw /dev/ttyS0

3.安裝

sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y cu hylafax-server hylafax-client

4.測試USB Modem

sudo cu -l ttyS0

出現connected.既可按兩下“.離開

5.設定HylaFAX

sudo faxsetup

6.設定撥號前按下0

sudo vim  /var/spool/hylafax/etc/config.ttyACM0 

修改ModemDialCmd設定:

ModemDialCmd:           ATX3D0T%s       # press 0 before dialing

7.傳真a.pdf至11223344

sendfax -n -d 11223344 a.pdf

8.查看

#歷史狀態
faxstat -d
#接收狀態
faxstat -r
#傳送狀態
faxstat -s

9.刪除job 1

faxrm 1

10.清除所有傳送資料(如果隔一陣子想要清除所有傳送資料的話)

sudo service hylafax stop
sudo rm -rf /var/spool/hylafax/docq/*
sudo rm -rf /var/spool/hylafax/doneq/*
sudo rm -rf /var/spool/hylafax/info/*
sudo rm -rf /var/spool/hylafax/log/*
sudo rm -rf /var/spool/hylafax/sendq/*
sudo service hylafax restart
faxstat -d