nginx 指定下载文件的文件名

server {
    .....

    location ~* .*\.(doc|txt|jar|zip|apk)(\?.*)?$ {
        if ($request_uri ~* ^.*\/(.*)\.(doc|txt|jar|zip|apk)(\?name=([^&]+))$) {
            add_header Content-Disposition "attachment;filename=$arg_name.$2";
        }
    }

根据pid热修改进程Max open files

accept(4, 0x7fff7b7be8d0, 0x7fff7b7be8cc) = -1 EMFILE (Too many open files)

prlimit --pid 12345 --nofile=1024:1024

查询某个进程打开文件数:

ls /proc/$pid/fd/ | wc -l

查询某个进程limit信息

cat /proc/12970/limits

阿里云RAW转换

qemu-img convert -p -f raw d_m-xxx_data_xvdb.raw -O vmdk d_m-xxx_data_xvdb.vmdk

-f raw 不要省略,否可能报以下错误信息:

block-vpc: free_data_block_offset points after the end of file. The image has been truncated.