Files
ServerUserCreate/user_zip.sh
2021-12-14 06:50:13 +09:00

20 lines
482 B
Bash
Executable File

#!/bin/bash
root_folder=$(pwd)'/';
if [ ! command -v zip &> /dev/null ]; then
echo "Missing zip application, aborting";
exit;
fi;
# arg 1 must be valid path to where we store the zip file
if [ ! -d "${1}" ]; then
echo "${1} is not a valid path";
exit;
fi;
# zip key folder, user list, user password into users.zip
echo "Zipping data to: ${1}/users.zip"
$(cd "${root_folder}"; zip -FSr "${1}/users.zip" "user_list.txt" "user_password.txt" "ssh-keygen/");
echo "Data zipped";