顯示具有 lftp 標籤的文章。 顯示所有文章
顯示具有 lftp 標籤的文章。 顯示所有文章

2025/01/10

在PVE中撈出所有guest的 cpu使用率並在超過上限值時發出告警


#!/bin/bash

pvesh get /cluster/resources|awk '{print $2" "$33" "$8}'|grep -E "lxc|qemu"|sed 's/....$//' > /tmp/all_guest_cpu

cat /tmp/all_guest_cpu | awk  '$3 > 80 {print $0}' > /tmp/guest_cpu_high

if [ -s /tmp/guest_cpu_high ]; then

        sed -i '1i network guest cpu high' /tmp/guest_cpu_high
        sed -i '2i ==========' /tmp/guest_cpu_high
        cp /tmp/guest_cpu_high /tmp/guest_cpu_high_network
        /usr/bin/lftp ftp://user:pwd@10.0.0.1 -e "put /tmp/guest_cpu_high_network; bye"
        mutt -s guest_cpu_high user@abc.com < /tmp/guest_cpu_high

fi

2024/08/22

使用lftp捉檔案時 如果本地端檔案已存在
會出現以下的錯誤

get:/tmp/822/log.txt:檔案早已存在,而且沒有設定 xfer:clobber 變數

在 /etc/lftp.conf加入以下這行即可

set xfer:clobber on


2020/08/19

 在shell使用lftp時出現一個問題

就是如果server連不上就會一直卡住

因為是使用crontab去撈資料

所以會有很多process都卡住

為了解決這個問題

必須設定timeout

在user的家目錄

mkdir .lftp

cd .lftp

vi rc

內容如下 可依需求修改

set net:timeout 5

set net:max-retries 2

set net:reconnect-interval-base 5


醬就ok了

2017/11/28

之前使用ftp傳檔時一直都用交談的方式
今天在測sftp時才發現lftp就可以了
範例如下

lftp ftp://user:password@host -e "put/tmp/data ; bye"

lftp sftp://user:password@host  -e "put local-file.name; bye"


2016/02/16

最近把server慢慢升到centos 7
一些轉換用到的東西記一下

原本使用ftp server 來傳資料 改用ssh
lftp sftp://user:password@host  -e "put local-file.name; bye"

裝好log server後使用 nc來進行測試
echo ‘<14>sourcehost message text’ | nc -v -u -w 0 server_ip 514

2015/01/07

最近在把檔案由ubuntu傳到win上的ftp server時發生了一些問題 在中文檔名及空格上
因為我在win上是使用 Rainbow FTP-G 是有支援UTF-8的 但要手動打開 預設沒開


在文字介面使用ftp指令時 碰到中文檔名無法上傳
使用filezilla強迫使用UTF-8也無法上傳
最後是使用lftp才正常
指令如下

mirror -R

ftp指令還能理解
但filezilla就不是很能接受了

2014/03/25

原來lftp可以用來下載torrent
現在才知道
語法如下
先進入lftp

lftp>torrent abc.torrent -O /path/to/save

2013/02/19

lftp使用sftp的方法如下

lftp sftp://root@10.0.0.1

帳號一定要打

2013/01/04

今天在ubuntu 12.04中使用lftp時出現

Certificate verification: Not trusted 的錯誤
找了一下資料
必須在user的home目錄下設定

~/.lftp/rc
set ssl:verify-certificate no


http://anils-tips.blogspot.tw/2011/05/lftp-fatal-error-certificate.html