#!/bin/bash
if find /root/y/gg -maxdepth 1 -name '*.md' -print -quit &>/dev/null; then
    cd /root/y/gg
    for file_name in *.jpg *.jpeg *.gif; do
        if [ "${file_name##*.}" == "jpg" ]; then
            magick "$file_name" "${file_name%.jpg}.avif" &&
                mv "${file_name%.jpg}.avif" "/root/y/static" &&
                rm "$file_name"
        fi
        if [ "${file_name##*.}" == "jpeg" ]; then
            magick "$file_name" "${file_name%.jpeg}.avif" &&
                mv "${file_name%.jpeg}.avif" "/root/y/static" &&
                rm "$file_name"
        fi
        if [ "${file_name##*.}" == "gif" ]; then
            magick "$file_name" "${file_name%.gif}.avif" &&
                mv "${file_name%.gif}.avif" "/root/y/static" &&
                rm "$file_name"
        fi
    done
    shopt -s nullglob
    files=(*.md)
    if [ ${#files[@]} -gt 0 ]; then
        mv "${files[@]}" 1.md
        mv 1.md "/root/y/content/posts"
        cd "/root/y/content/posts"
        python3 zidong.py
    fi
fi
弄了半天,imagemagick就是不支持png和heic,人要气死了。😡
记录一下nginx配置文件
右侧再搞一个可爱的gif
server {
    listen  443 ssl;
    listen  [::]:443 ssl;
    server_name liuzouyuan.cn;
	
    ssl_certificate /etc/nginx/ssl/liuzouyuan.cn/fullchain.cer;
    ssl_certificate_key /etc/nginx/ssl/liuzouyuan.cn/liuzouyuan.cn.key;
    root /root/y/public;
    location / {
                index index.html index.htm;
                try_files $uri $uri/ /index.html;
    }
    
    error_page 404 /404.html;
        location = /40x.html {
    }
	
    location = /favicon.ico {
		root /root/y/gg;
	}
}
server {
	listen 80 default_server;
	listen [::]:80 default_server;
	server_name liuzouyuan.cn;
	root /root/y/public;
    location / {
                index index.html index.htm;
                try_files $uri $uri/ /index.html;
    }
    
    error_page 404 /404.html;
        location = /40x.html {
    }
	
    location = /favicon.ico {
		root /root/y/gg;
	}
}
server  {
        listen  80;
        server_name *.liuzouyuan.com;
        return  301 https://liuzouyuan.cn$request_uri;
}
server  {
        listen  80;
        server_name liuzouyuan.com;
        return  301 https://liuzouyuan.cn$request_uri;
}
server  {
        listen  80;
        server_name *.liuzouyuan.cn;
        return  301 https://liuzouyuan.cn$request_uri;
}
