春有百花秋有月
夏有凉风冬有雪bitwarden-backup-crontab
crontab -l
crontabl -e
0 0 * * * /opt/bitwarden-backup/bw-data-backup.sh >> /opt/bitwarden-backup/backup.log && find /home/appadmin/bitwarden-backup/ -type f -name "bw-data_backup_*" -mtime +7 -exec rm {} \;
更换到挂载存储之后超过七天的文件没有删除,不知道为什么,换一种方式试试:
0 0 * * * /opt/bitwarden-backup/bw-data-backup.sh >> /opt/bitwarden-backup/backup.log && find /home/appadmin/bitwarden-backup/ -type f -name "bw-data_backup_*" |xargs rm -f
压缩
tar -czvf /path/to/file.tar.gz file
解压
tar -xzvf /path/to/file.tar.gz
加密压缩
tar -czvf - file | openssl des3 -salt -k password -out /path/to/file.tar.gz
for example:
tar -czvf - runshtest | openssl des3 -salt -k password -out ../1.tar.gz
解密解压
openssl des3 -d -k password -salt -in /path/to/file.tar.gz | tar xzf -
for example:
阅读剩余部分 →mount onedrive by Rclone
在Windows电脑上下载Rclone,下载地址:> https://rclone.org/downloads/,然后解压,使用cmd进入解压后的文件夹:
rclone.exe authorize "onedrive"
ps:整个大括号就是token,包括大括号。
直接使用官方提供的一键脚本:
curl https://rclone.org/install.sh | bash
3.配置
安装完成后执行:
rclone config
rclone config
2021/03/03 15:00:17 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> onedrive
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / 1Fichier
\ "fichier"
2 / Alias for an existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Citrix Sharefile
\ "sharefile"
9 / Compress a remote
\ "compress"
10 / Dropbox
\ "dropbox"
11 / Encrypt/Decrypt a remote
\ "crypt"
12 / Enterprise File Fabric
\ "filefabric"
13 / FTP Connection
\ "ftp"
14 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
15 / Google Drive
\ "drive"
16 / Google Photos
\ "google photos"
17 / Hadoop distributed file system
\ "hdfs"
18 / Hubic
\ "hubic"
19 / In memory object storage system.
\ "memory"
20 / Jottacloud
\ "jottacloud"
21 / Koofr
\ "koofr"
22 / Local Disk
\ "local"
23 / Mail.ru Cloud
\ "mailru"
24 / Mega
\ "mega"
25 / Microsoft Azure Blob Storage
\ "azureblob"
26 / Microsoft OneDrive
\ "onedrive"
27 / OpenDrive
\ "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
29 / Pcloud
\ "pcloud"
30 / Put.io
\ "putio"
31 / QingCloud Object Storage
\ "qingstor"
32 / SSH/SFTP Connection
\ "sftp"
33 / Sugarsync
\ "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
\ "tardigrade"
35 / Transparently chunk/split large files
\ "chunker"
36 / Union merges the contents of several upstream fs
\ "union"
37 / Webdav
\ "webdav"
38 / Yandex Disk
\ "yandex"
39 / Zoho
\ "zoho"
40 / http Connection
\ "http"
41 / premiumize.me
\ "premiumizeme"
42 / seafile
\ "seafile"
Storage> 26
** See help for onedrive backend at: https://rclone.org/onedrive/ **
OAuth Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").
Choose a number from below, or type in your own value
1 / Microsoft Cloud Global
\ "global"
2 / Microsoft Cloud for US Government
\ "us"
3 / Microsoft Cloud Germany
\ "de"
4 / Azure and Office 365 operated by 21Vianet in China
\ "cn"
region> 1
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> n
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "onedrive"
Then paste the result below:
result> {"access_token":qqqqqqqqqq","expiry":"2021-03-03T15:54:34.7442912+08:00"}
token
Choose a number from below, or type in an existing value
1 / OneDrive Personal or Business
\ "onedrive"
2 / Root Sharepoint site
\ "sharepoint"
3 / Sharepoint site name or URL (e.g. mysite or https://contoso.sharepoint.com/sites/mysite)
\ "url"
4 / Search for a Sharepoint site
\ "search"
5 / Type in driveID (advanced)
\ "driveid"
6 / Type in SiteID (advanced)
\ "siteid"
7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
\ "path"
Your choice> 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!B6yHyawk7kq599Kb4wYXQFe1jafkFoFBqrwS7ZFYLJsUbhule-g-Rax7IpAhk6c8
Chose drive to use:> 0
Found drive 'root' of type 'business', URL: https://imissyou5201314-my.sharepoint.com/personal/codehero_imissyou5201314_onmicrosoft_com/Documents
Is that okay?
y) Yes (default)
n) No
y/n>y
--------------------
[onedrive]
type = onedrive
region = global
token = {"access_token":"O2bSfUr74YzUssTNQqL2bUzCbxlZMNHa5OEdJwZuOXPfv6IdCdk_E1jWMmjxHNIi7NLZ6GWqaOUARsqq_5JLTDEpo6F5VS5vbTOOVuDP3MhAcvL9aSXBk7BKxXu6yMoZp7uaynmCESg4ADFEFSSefwefwefsefwfgsalkfhsehjfg2bewo_EASPdtlIkjW0v5lCliU1cXxuPGZ_Lq1eOYyjPLMvAJ9pMiKg2-Iw1-844H67E0V9FCY8cBzH3qSui8rgQwt9nBI2PI0uaJ6KlVpQb0IiTQGapw2hgubwprnSVM39B5Z58WUon2ObcJ76CP7VPMvxIFIVnP5oq2gi1PRTxPgN3z64z3Q1hbwM59HqOrwX84uWIvCk63_i6ocVb0nasiY7EaLoF9fJHAnAw2qC3dOng","expiry":"2021-03-03T15:54:34.7442912+08:00"}drive_id = b!B6yHyawk7kq599Kb4wYXQFe1jafkFoFBqrwS7ZFYLJsUbhule-g-Rax7IpAhk6c8
drive_type=business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
onedrive onedrive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
e/n/d/r/c/s/q>
4.安装fuse
apt install fuse3
5.挂载OneDrive
-新建挂载目录
阅读剩余部分 →debian resolv.conf 重启丢失
执行:
apt-get install resolvconf
在/etc/resolvconf/resolv.conf.d/base中增加:
阅读剩余部分 →无线鼠标卡顿
电脑右键-->管理-->设备管理器-->点通用串行总线前面的小>展开-->USB根集线器右键-->属性-->电源管理-->取消选中允许计算机关闭此设备以节约电源
下面还有两个 通用USB**集线器,同样的操作。
tar file add passwd
使用tar对文件压缩加密:
tar -zcvf - pma|openssl des3 -salt -k password | dd of=pma.des3
完成将得到一个pma.des3的打包文件,用你设置的密码替换password。
使用tar对加密文件解压:
dd if=pma.des3 |openssl des3 -d -k password|tar zxf -
注意:命令最后有”-”,它将释放所有的文件。其中-k password可以不使用,这样执行完命令后会提示你输入密码,加上-k参数表示在程序中自动验证密码。
阅读剩余部分 →install chatgpt demo
#更新
sudo apt update
sudo apt upgrade
# 安装依赖
sudo apt install software-properties-common
# 添加 deadsnakes PPA 源
sudo add-apt-repository ppa:deadsnakes/ppa
#安装python
sudo apt install python3
python3 --version
sudo apt install python3-pip
pip3 --version
2.安装python虚拟环境
sudo apt install python3-venv
3.上传chatgpt-web-main.tar.gz,解压并进入到chatgpt-web-main目录
4.创建虚拟环境:
python3 -m venv newchat.env
5.进入虚拟环境
source /opt/chat/chatgpt-web-main/newchat.env/bin/activate
6.配置chatgpt-web-main应用中的openAi key,启动服务:
python3.10 /opt/chat/chatgpt-web-main/main.py
nohup python3.10 /opt/chat/chatgpt-web-main/main.py &
7.配置nginx文件:
server {
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name chat.***.xyz;
ssl_certificate /root/.acme.sh/chat.***.xyz_ecc/chat.***.xyz.cer;
ssl_certificate_key /root/.acme.sh/chat.***.xyz_ecc/chat.***.xyz.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_session_cache builtin:1000 shared:SSL:10m;
proxy_buffering off;
location / {
proxy_redirect off;
proxy_pass http://127.0.0.1:8184/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
其中proxy_buffering off; 表示打字机效果,不加此行代码无打字机效果,等待输出结果之后一次性返回结果。
阅读剩余部分 →windows bat from linux
1.将以下脚本写入bat文件:执行同步并且本地只保留一周的文件.
start /min cmd /c "C:\Users\user1\AppData\Local\Programs\WinSCP\WinSCP.exe" /console /script=D:\gz\52.69\bak\bitwarden-backup\server_bak.txt
set SrcDir=D:\gz\52.69\bak\bitwarden-backup\bak
set DaysAgo=5
forfiles /p %SrcDir% /s /m *.* /d -%DaysAgo% /c "cmd /c rd /s /q @path"
forfiles /p %SrcDir% /s /m *.* /d -%DaysAgo% /c "cmd /c del /f /q /a @path"
2.定义server_bak.txt文件:
阅读剩余部分 →typecho install and htpasswd config
apt-get update
apt-get install apache2-utils
htpasswd -c /etc/nginx/.htpasswd gz
/etc/nginx/.htpasswd gz
二、安装typecho
https://docs.typecho.org/install
下载php及相关依赖
sudo apt-get install php7.4 php7.4-sqlite php7.4-fpm php-mbstring php7.4-gd安装依赖 sudo apt install php php-cli php-fpm php-mysql php-json php-opcache php-mbstring php-xml启动php服务:查找对应的 PHP-FPM systemd 服务单元文件。在 /lib/systemd/system/ 目录下查找以 php{version}-fpm.service 命名的文件,例如:
service php7.4-fpm start下载源码(可以在typecho官网找到)
wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip解压源码
unzip typecho.zip对整个源码目录赋予足够的权限
chmod -R 777 /home/typecho配置nginx
server{ listen 80; server_name ****.xyz; root /var/www/typecho; index index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location / { root html; index index.php index.html index.htm; set $path_info ""; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; } location /admin { index index.php; try_files $uri $uri/ /admin/index.php?$args; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; } # Typecho static files location ~* ^/(usr|admin|themes|plugins)/.*\.(js|css|png|jpg|jpeg|gif|ico|svg)$ { expires 24h; add_header Cache-Control public; access_log off; try_files $uri $uri/ /index.php?$args; } }访问:http://****.xyz/install.php 选择sqlite数据库然后下一步...
阅读剩余部分 →
linux crontab
定时任务,自动更新证书和备份文件仅保留一周内的:
[root@iZj6c69digospl6f2d3s45Z bitwarden-backup]# crontab -l
21 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
0 0 * * * /opt/bitwarden-backup/bw-data-backup.sh >> /opt/bitwarden-backup/backup.log && find /home/appadmin/bitwarden-backup/ -type f -name "bw-data_backup_*" -mtime +7 -exec rm {} \;
编辑命令:
crontab -e
使之生效:
阅读剩余部分 →