2020年1月22日 星期三

Debian/Ubuntu :Fix add-apt-repository: command not found error

sudo apt-get install software-properties-common

Raspberry pi 設定無線網路、開啟 ssh

boot 區下 產生檔名 ssh 檔案

boot 區下 產生 wpa_supplicant.conf 檔案內容
country=TW
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="SSID_NAME"
    psk="SSID_KEY"
    key_mgmt=WPA-PSK
    scan_ssid=1
}

squid custom authentication helper 摘要

#!/bin/bash
read a

echo user=${a% *} password=${a#* } >/tmp/input

#echo -e "OK";
echo -e "ERR";

squid 設定方式
auth_param basic program /usr/bin/bash /tmp/1.sh
auth_param basic children 5
auth_param basic realm Please enter your proxy server username and password
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive on

acl authenticated proxy_auth REQUIRED
http_access allow authenticated

查詢 Debian /Ubuntu 版本

lsb_release
hostnamectl

cat /etc/os-release

IMS4000取得 datalog

#!/bin/bash
ip=192.168.0.1
username=admin
password=password

url="http://${ip}/cgi-bin/web2timehist.cgi?unit=0&chan=0&ip=100&frame=82"

x=$(curl -s --cookie "username=${username}; password=${password}" $url|sed -e 's/<[/]tr>/ \n/g'|sed -e 's/<[^>]*>/ /g'|sed '/^$/d')&&x=${x#*GMT\"}&&x=${x%<!--*}&&IFS=xxxxxxx&&echo ${x}|while read a;do [ ${#a} -gt 18 ]&&echo  $a|tr -s " ";done;

IMS4000取得目前狀況

#!/bin/bash
ip=192.168.0.1
username=admin;
password=password;

url="http://${ip}/cgi-bin/do_frames.cgi?unit=0&frame=202"
url="http://${ip}/cgi-bin/do_frames.cgi?unit=1&frame=202"
#url="http://${ip}/cgi-bin/do_frames.cgi?unit=2&frame=202"

x=$(curl -s --cookie "username=${username}; password=${password}" $url|sed -e 's/<[/]td>/ \n/g'|sed -e 's/<[^>]*>/ /g'|sed '/^$/d')&&x=${x##*//-->};

OIFS=$IFS&&IFS=xxxxxx;
x=$(echo $x|while read i;do ii=$(echo $i|tr -d " \n"|grep -v onClick|grep -v onmouse);[ ${#ii} -gt 2 ]&&echo $ii;done);

IFS=$OIFS&&n=0;

for i in $x;do echo -n "${i%°C} ";n=$(($n + 1));[ $(($n %4)) -eq 0 ]&&echo ;done;

2020年1月2日 星期四

Debian 10 nfs ganesha 安裝摘要

安裝
apt install -y nfs-ganesha  nfs-ganesha-vfs

編輯設定檔 /etc/ganesha/ganesha.conf
EXPORT
{
        # Export Id (mandatory, each EXPORT must have a unique Export_Id)
        Export_Id = 1;

        # Exported path (mandatory)

        Path = /nfs;

        # Pseudo Path (required for NFS v4)

        Pseudo = /nfs;

        # Required for access (default is None)
        # Could use CLIENT blocks instead
        Access_Type = none;
        Squash = No_root_squash;

       CLIENT {
                Clients = 192.168.1.0/24;
                Access_Type = RW;
        }


        # Exporting FSAL
        FSAL {
                Name = VFS;
        }
}



啟動服務
systemctl restart nfs-ganesha