#!/bin/bash
echo pid=$$
(kill -STOP $$;kill -CONT $$) &
while true; do echo pid=$$;sleep 1;done
#!/bin/bash
echo pid=$$
(kill -STOP $$;kill -CONT $$) &
while true; do echo pid=$$;sleep 1;done
#!/bin/bash
# /var/log/lastlog > 1g
_debug=;
mfile=/var/log/lastlog
archive_dir=/var/log
_f0=$(echo $0|tr \/ _)-$(echo ${*}|md5sum|awk '{print $1}');
exec 100> /tmp/${_f0}.lock
flock -n 100 || exit 1
echo $$ $(date +%Y%m%d-%H%M%S) $0 $* >&100
inotifywait -m ${mfile} |while read dir action file;
do [ -z "$file" ]&&_f=$dir||_f=${dir}/${file};
[ -z "$_debug" ]|| echo debug: $dir $action $file f=$_f;
a_f=$(basename $mfile).$(date +%Y%m%d-%H%M%S);
[ -z "$(ls -lh $_f|awk '{ print $5}'|grep G)" ]||{ lastlog >${archive_dir}/$a_f; :>$mfile; [ -z "$_debug" ]||echo "run..."; }
done;
#!/bin/bash
_lastlog=/var/log/lastlog
_lastarchive=/var/log/lastlog
[ -f $_lastlog ]||exit 0;
[ -z "$(ls -lh $_lastlog|awk '{print $5}'|grep G)" ]&& exit 0;
lastlog > ${_lastarchive}.$(date +%Y%m%d-%H%M%S);
:>$_lastlog;
編輯 /usr/share/desktop-base/profiles/xdg-config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
<channel> 加入
<property name="desktop-icons" type="empty">
<property name="file-icons" type="empty">
<property name="show-trash" type="bool" value="false"/>
<property name="show-filesystem" type="bool" value="false"/>
<property name="show-home" type="bool" value="false"/>
</property>
</property>
apt install -y gpg
wget -O - https://download.gluster.org/pub/gluster/glusterfs/9/rsa.pub | apt-key add -
DEBID=$(grep 'VERSION_ID=' /etc/os-release | cut -d '=' -f 2 | tr -d '"')
DEBVER=$(grep 'VERSION=' /etc/os-release | grep -Eo '[a-z]+')
DEBARCH=$(dpkg --print-architecture)
echo deb https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/${DEBID}/${DEBARCH}/apt ${DEBVER} main > /etc/apt/sources.list.d/gluster.list
apt update
apt install glusterfs-server
安裝
apt install bcache-tools
建立資料碟(必須大於快取碟)
make-bcache -B /dev/sdx1
建立快取碟(ram disk 不適用)
make-bcache --block 4k --bucket 2M -C /dev/sdy1
指定 資料碟的快取碟
echo $(bcache-super-show /dev/sdy1|grep cset.uuid|awk '{print $2}') >/sys/block/bcache0/bcache/attach
make-bcache -B /dev/sda /dev/sdb -C /dev/sdc
查詢 bcache 運作狀態
cat /sys/block/bcache0/bcache/state
no cache: 沒有 cache 設備
clean: 正常,cache clean
dirty: 正常,cache 模式 writeback,cache 狀態 dirty
inconsistent: 有問題,cache 及 資料沒有同步
查詢cache 模式
cat /sys/block/bcache0/bcache/cache_mode
[writethrough] writeback writearound none
更改 cache 模式
echo writeback > /sys/block/bcache0/bcache/cache_mode
bcache 裝置顯示
/dev/bcacheN
/dev/bcache/by-uuid/UUID
/dev/bcache/by-label/LABEL
停用設備
echo 1 > /sys/block/sdX/sdX[Y]/bcache/stop
停止快取
echo 1 > /sys/block/sdX/sdX[Y]/bcache/detach
安全移除快取
echo <cache-set-uuid> > /sys/block/bcache0/bcache/detach
釋放已使用裝置
echo 1 > /sys/fs/bcache/<cache-set-uuid>/stop
重新載入 bcache 裝置
partprobe (apt install parted)
echo /dev/sdX > /sys/fs/bcache/register
echo /dev/sdY > /sys/fs/bcache/register
Force flush of cache to backing device
echo 0 > /sys/block/bcache0/bcache/writeback_percent
相關檔案 /etc/tmpfile.d/bcache.conf
w /sys/block/bcache0/bcache/sequential_cutoff - - - - 1M
w /sys/block/bcache0/bcache/cache_mode - - - - writeback
原因可能是 Apache2.4 的部分指令和 Apache2.2 不相容
參考
http://httpd.apache.org/docs/2.4/upgrading.html
apt install davfs2
mount -t davfs -o noexec https://server/webdav/ /mnt/dav/
/etc/fstab 格式
https://server/webdav/ /mnt/WebDAV davfs _netdev,noauto,user,uid=nobody,gid=nobody 0 0
免輸入帳號密碼編輯 /etc/davfs2/davfs2.conf
編輯 /etc/davfs2/secrets
建立儲存位置
mkdir /home/webdav
chown www-data. /home/webdav
編輯 /etc/apache2/sites-available/webdav.conf
Alias /webdav /home/webdav
<Location /webdav>
DAV On
#SSLRequireSSL
Options None
AuthType Basic
AuthName WebDAV
AuthUserFile /home/webdav/.htpasswd
Options +Indexes
DirectoryIndex inexistentfile
<RequireAny>
Require method GET POST OPTIONS
Require valid-user
</RequireAny>
# Require all granted
</Location>
載入 Apache 相關模組
a2enmod dav*
a2ensite webdav
程啟服務
systemctl restart apache2
安裝 SAIGE v0.45
https://github.com/weizhouUMICH/SAIGE
1.設定 Python 2.7.17 環境
pip install cget
2. R
install.packages("R.utils", "Rcpp", "RcppParallel", "RcppArmadillo", "data.table", "RcppEigen", "Matrix", "methods", "BH", "optparse", "SPAtest", "SKAT","devtools")
devtools::install_github("leeshawn/MetaSKAT")
devtools::install_github("weizhouUMICH/SAIGE")
下載失敗可先將檔案下載後安裝
src_branch=master
repo_src_url=https://github.com/weizhouUMICH/SAIGE
git clone --depth 1 -b $src_branch $repo_src_url
R CMD INSTALL --library=path_to_final_SAIGE_library SAIGE
其他
1.安裝時會連上網路下載檔案
2. http://zlib.net/zlib-1.2.11.tar.gz 連結已變更 https://zlib.net/fossils/zlib-1.2.11.tar.gz會造成安裝失敗
安裝及啟用 Haveged 服務
apt install haveged -y
yum install haveged -y
echo|openssl s_client -servername www.edu.tw -connect www.edu.tw:443|openssl x509 -noout -dates
curl -s -v -k https://www.edu.tw 2>&1 | grep -E "Connected to|subject|expire"
軟體安裝
apt update;apt upgrade -y
apt install -y git python3-pip
apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
環境設定
cat <<EOF >pyenv0.sh
export PYENV_ROOT="\$HOME/.pyenv"
export PATH="\$PYENV_ROOT/bin:\$PATH"
type pyenv >/dev/null 2>&1||eval "\$(pyenv init -)"
EOF
source pyenv0.sh
相關指令
pyenv version
pyenv versions
pyenv install <python版本>
pyenv install --list
pyenv uninstall <python版本>
pyenv global <python版本>
pyenv local <python版本>
pyenv shell <python版本>
更新 pyenv
cd ~/.pyenv
git pull
其它
~/.pyenv/cache 設定安裝時來源檔,不上網抓取 Python-xx.tar.xz
~/.pyenv/versions 各版本安裝位置
echo -n #password|remmina --encrypt-password 2>/dev/null|grep "Encrypted password:" |awk '{print $3}'