Author Archives: cowman.chiang

Shell Script 計算字元

cowman@ubuntu:~$ string=”0123 56 89″; echo “length: ${#strstring ing}” length: 10

Posted in Linux, Shell Script | Leave a comment

使用GMail SMTP寄信 – ssmtp (CentOS)

yum install ssmtp vim /etc/ssmtp/ssmtp.conf root=username@gmail.com mailhub=smtp.gmail.com:587 RewriteDomain= Hostname=username@gmail.com UseSTARTTLS=yes AuthUser=username@gmail.com AuthPass=password FromLineOverride=YES TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt alternatives –config mta 選擇 /usr/sbin/sendmail.ssmtp 檢查目前sendmail方式 sendmail -V sSMTP 2.61 (Not sendmail at all) 測試 echo “This is a test” | mail -s “Test” cowman.chiang@gmail.com Reference … Continue reading

Posted in CentOS | Leave a comment

使用GMail SMTP寄信 – command (CentOS)

近來發現diary log幾乎都收不到了 測試了一下, 發現連手動執行script都失敗 所以想一下就改用GMail SMTP應該比較保險 Reference: 在 Linux 上直接用 Gmail SMTP 寄信 yum install mailx vim ~/.mailrc account gmail { set smtp-use-starttls set smtp=smtp://smtp.gmail.com:587 set smtp-auth=login set smtp-auth-user=username@gmail.com set smtp-auth-password=password set from=”username@gmail.com” set ssl-verify=ignore set nss-config-dir=/root/.pki/nssdb set nss-config-dir=/etc/pki/nssdb } … Continue reading

Posted in CentOS | Leave a comment

Gitlab改使用GMail SMTP

檢查 config/environments/production.rb 檔案,查看 config.action_mailer.delivery_method = :sendmail 的註解是否已增加,關閉Gitlab sendmail寄送服務 config.action_mailer.delivery_method = :sendmail [註] 使用這一篇 使用GMail SMTP寄信 (Ubuntu) 的方法應該也可以~但是目前會出現 “Mail failure – no recipient addresses” A message that you sent using the -t command line option contained no addresses that were not … Continue reading

Posted in Git, Ubuntu | Leave a comment

使用GMail SMTP寄信 (Ubuntu)

安裝mailx、exim4 apt-get install exim4-daemon-light mailutils dpkg-reconfigure exim4-config General type of mail configuration: │ internet site; mail is sent and received directly using SMTP │ │ mail sent by smarthost; received via SMTP or fetchmail │ │ mail sent by smarthost; … Continue reading

Posted in Ubuntu | Leave a comment

SSH 登入時寄發通知信件

vim ~/.bashrc echo ‘ALERT – Shell Access (WP) on:’ date who | mailx -A gmail -s “Alert: Shell Access from who | cut -d'(‘ -f2 | cut -d’)’ -f1” cowman.chiang@gmail.com > /dev/null 2>&1 搭配 使用GMail SMTP寄信 這一篇進行 其中 > /dev/null … Continue reading

Posted in Linux | Leave a comment

CentOS 快速安裝 Nginx with RTMP module

跟 之前裝在Ubuntu的那一篇 一樣 都是沒有設定stat的部分, 需要在另外修改 大致上跟Ubuntu的方式都相同 只是要注意的為 init script 可不可正常進行 測試的範例中是修改 nginx.conf 將 pid 那一行給取消註腳 pid logs/nginx.pid; #!/bin/sh yum groupinstall ‘Development Tools’ -y yum install pcre pcre-devel openssl-devel libxslt-devel -y cd /tmp wget http://nginx.org/download/nginx-1.7.3.tar.gz wget https://github.com/arut/nginx-rtmp-module/archive/master.zip tar -zxvf nginx-1.7.3.tar.gz yum … Continue reading

Posted in CentOS, Nginx, RTMP | Leave a comment

Cacti Debug : 圖出不來

檢查 Management => Graph Management => 找到出不來的圖 => Turn On Graph Debug Mode 看看rrdtool的log資訊為何

Posted in Cacti | Leave a comment

Cacti 自訂 Script php

記得php檔案最後return值格式 新增 Data Input Methods <== 呼叫script php方法 Input Type => Script – Script Server (PHP) Input String => /scripts/[php檔名] [php內使用的function名稱] <hostname> [參數值] Input Fields => hostname — Special Type Code ==> hostname Output Fields => 欄位名稱 新增Data Templates Data … Continue reading

Posted in Cacti | Leave a comment

VMware esxi command : esxcli

esxcli hardware ipmi sdr list //取得感應器資訊 esxcli system process stats load get //取得目前負載狀況 參考

Posted in VMware | Leave a comment