code-test

2015年10月2日 星期五

使用命令方式新增 node 伺服器

使用命令方式新增 node 伺服器

Adding too much f5 nodes to ltm with one liner

#netscaler.txt

G01        10.1.1.1
P01        10.1.1.2
P02        10.1.1.3
P03        10.1.1.4
F01        10.1.1.5
F02        10.1.1.6
F03        10.1.1.7
F04        10.1.1.8
F05        10.1.1.9
F06        10.1.1.10
F07        10.1.1.11
F08        10.1.1.12
F09        10.1.1.13

etc 2000 lines.


cat netscaler.txt  | while read line; do INF=(echo $line); tmsh create /ltm node ${INF[1]} address ${INF[2]} monitor icmp ; done

取自國外網友

2015年8月29日 星期六

編輯Trunkey Server tomcat


修改index.jsp

vi /var/lib/tomcat6/webapps/ROOT/

    <body bgcolor="pink" >
<body bgcolor="#cccccc">
<body bgcolor="orange">

修改背景顏色
    <body bgcolor="pink" >
        <h1>TurnKey Server 1 Tomcat</h1>

字體加大
    <body bgcolor="pink" >
        <h1><font size="7">TurnKey Server-01 Tomcat</font></h1>


<input type="button" style="background-color:#FFF0D4" value="這是背景顏色為 #FFF0D4 的按鈕"><br>
<input type="button" style="background-color:#FFFF78" value="這是背景顏色為 #FFFF78 的按鈕"><br>
<input type="button" style="background-color:#FFD4D4" value="這是背景顏色為 #FFD4D4 的按鈕"><br>
<input type="button" style="background-color:#C9FFC9" value="這是背景顏色為 #C9FFC9 的按鈕"><br>
<input type="button" style="background-color:#C2C2FF" value="這是背景顏色為 #C2C2FF 的按鈕">


範例效果





#!/bin/bash
# author       oscarwu
# date         2015-08-30
# description  備份設定 檢查
# != 不等於
    echo "check crontab  job "

    if [[ `grep "backup_config.sh" /etc/crontab` = "" ]];then
echo "00 5 * * * /sbin/backup_config.sh" >> /etc/crontab
echo -e "\n\e[1;36m check add script ... OK! \e[0m"
   else
        echo -e "\n\e[1;36m no add crontab backup_config.sh root ... OK! \e[0m"
fi


2015年8月25日 星期二

shell script 檢查目錄,沒有目錄並建立

#!/bin/sh
#shell判斷檔,目錄是否存在或者具有許可權
Path="/var/log/httpd/"
File="/var/log/httpd/access.log"

#這裡的-x 參數判斷$Path是否存在並且是否具有可執行許可權
if [ ! -x "$Path"]; then
mkdir "$Path"
fi

#這裡的-d 參數判斷$Path是否存在
if [ ! -d "$Path"]; then
mkdir "$Path"
fi

#這裡的-f參數判斷$File是否存在
if [ ! -f "$File" ]; then
touch "$File"
echo "檢查資料檔案不存在已建立"
fi

#其他參數還有-n,-n是判斷一個變數是否是否有值
if [ ! -n "$Var" ]; then
echo "$Var is empty"
exit 0
fi

#兩個變數判斷是否相等
if [ "$var1" = "$var2" ]; then
echo '$var1 eq $var2'
else
echo '$var1 not eq $var2'
fi

echo "程式繼續...."

/etc/crontab 內容
10 0 * * * root /usr/sbin/ntpdate time.stdtime.gov.tw; /usr/sbin/hwclock -w
40 5 * * * root yum -y update && yum clean packages

2015年6月4日 星期四

2015年5月3日 星期日

Juniper SRX reinstall or update

使用Juniper junos 作業系統要更新版本有幾種方試
 1.將Juniper SRX 開機當看到下列文字時按Space
loading /boot/defaults/loader.conf