You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
646 B

3 years ago
3 years ago
3 years ago
3 years ago
  1. #!/bin/bash
  2. input="accountsn.csv"
  3. OLDIFS=$IFS
  4. IFS=','
  5. var_apache_user=www-data
  6. var_path_nextcloud=/usr/share/nginx/nextcloud/
  7. while read -r display_name username group password email
  8. do
  9. var_display_name=$(echo $display_name )
  10. var_username=$(echo $username )
  11. var_group=$(echo $group )
  12. var_password=$(echo $password )
  13. var_email=$(echo $email )
  14. echo "account : ${email}"
  15. export OC_PASS={$var_password}
  16. 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}' "
  17. done < $input
  18. IFS=$OLDIFS