From dc86b0281368df12682b0964c0be674ae17f483d Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 1 Sep 2021 10:16:48 +0200 Subject: [PATCH] ver 1.0 --- Nextcloud/imports-account-csv.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Nextcloud/imports-account-csv.sh b/Nextcloud/imports-account-csv.sh index 9daeafb..01d8e0b 100644 --- a/Nextcloud/imports-account-csv.sh +++ b/Nextcloud/imports-account-csv.sh @@ -1 +1,22 @@ -test + #!/bin/bash +input="accountsn.csv" +OLDIFS=$IFS +IFS=',' +var_apache_user=www-data +var_path_nextcloud=/usr/share/nginx/nextcloud/ +var_result_file="${var_datum}_user_create.txt" +while read -r display_name username group password email +do + + var_display_name=$(echo $display_name ) + var_username=$(echo $username ) + var_group=$(echo $group ) + var_password=$(echo $password ) + var_email=$(echo $email ) + echo "resultat :" + echo ${var_username} + export OC_PASS={$var_password} + su -s /bin/sh ${var_apache_user} -c " php ${var_path_nextcloud}occ user:add --display-name='${var_display_name}' --password-from-env --group='${var_group}' '${var_username}' " + +done < $input +IFS=$OLDIFS