Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (51)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (2)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (80)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (8)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: Shell Script
Delete snapshots older than 7 days
To avoid running out of disk space in our test environment, we developed a plan to regularly execute shell scripts to clean up unnecessary snapshots. #!/bin/bash week=`date –date=’7 days ago’ +’%Y%m%d’` echo “list_snapshots” | /home/webuser/hbase-1.2.9/bin/hbase shell | grep “pattern ” … Continue reading
Posted in HBase, Shell Script
Comments Off on Delete snapshots older than 7 days
[Shelll Script] check tomcat status
!/bin/bash tomcat7=$(ps -ef | grep tomcat | wc -l) echo ${#tomcat7} if [ ${#tomcat7} -gt 0 ]; then printf “tomcat is running\n” else printf “tomcat is not running\n” fi
Posted in Linux, Shell Script, Tomcat
Leave a comment
Redirect stdout to logFile in shell script
exec > >(tee -i logfile.txt) source: stackoverflow: redirect COPY of stdout to log file from within bash script itself
Posted in Shell Script
Leave a comment
find unused files and delete them
find /var/log/radius/radacct -type f -name “reply*” -mtime +60 -exec rm -rf {} \; -mtime N — more than N days without being edited -exec CMD {} \; — comands, {} means the files which be found.
Posted in Linux, Shell Script
Leave a comment
Parse JSON string via command line
Ref.:How to parse JSON string via command line on Linux Ubuntu: apt-get install jq Mac: brew install jq
Posted in Shell Script
Leave a comment
Redir 每日記錄回報
#!/bin/sh /bin/cat /var/log/syslog* | grep -a “ubuntu redir” | grep “`date –date=yesterday +%b %e`” > /root/diary.log /bin/zcat /var/log/syslog.*.gz | grep -a “ubuntu redir” | grep “`date –date=yesterday +%b %e`” >> /root/diary.log if [ -s /root/diary.log ] ; then /bin/cat /root/diary.log| … Continue reading
Posted in Linux, Shell Script
Leave a comment
Shell Script Dialog
Dialog 預設設定通常在個人Home目錄下的檔案”.dialogrc” 可使用指令 “dialog –create-rc ~/.dialogrc” 產生 因為預設底色是青色,結束後會有色塊殘留,所以建議將screen_color調整為黑色 也可在 dialog 指令執行前先指定使用哪一個設定檔案進行dialog “export DIALOGRC=${path}/dialog.installer” 記得離開前把DIALOGRC清空就好 下面是將常用的dialogrc寫成function dialog_msgbox() { #$1 => msgbox的類別{no clear, clear, clear & exit}, $2 => 前視窗的文字說明, $3 => 顯示的資訊文字 case $1 in 0) dialog –backtitle “${backtitle}” –title “$2” … Continue reading
Posted in Shell Script
Leave a comment
Shell Script 計算字元
cowman@ubuntu:~$ string=”0123 56 89″; echo “length: ${#strstring ing}” length: 10
Posted in Linux, Shell Script
Leave a comment