Skip to content

Instantly share code, notes, and snippets.

@zdev0x
Created September 9, 2019 07:18
Show Gist options
  • Select an option

  • Save zdev0x/932811a0997b425469710479ec4e1088 to your computer and use it in GitHub Desktop.

Select an option

Save zdev0x/932811a0997b425469710479ec4e1088 to your computer and use it in GitHub Desktop.
加密压缩打包ssl证书脚本
#!/bin/bash
# filename: archive_ssl.sh
# 压缩文件密码
PASSWORD="zip_password"
# ssl 归档目录
SSL_ARCHIVE_DIR="/data/wwwroot/default/export/ssl/"
# 日期
CUR_DATE=$(date "+%Y%m%d")
pushd /usr/local/openresty/nginx/conf/ssl > /dev/null
CUR_SSL_ZIP="ssl_${CUR_DATE}.zip"
zip -P ${PASSWORD} -r ${CUR_SSL_ZIP} ./
if [ ! -e $CUR_SSL_ZIP ]; then
echo "ZIP ${CUR_SSL_ZIP} Error"; exit 1;
fi
mv ${CUR_SSL_ZIP} ${SSL_ARCHIVE_DIR}
printf "ZIP:Success\n"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment