EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #09126


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] How can i delete thousands of fake users?


Hi Christian,

In the comment at the top of https://gist.github.com/jesusbagpuss/d5fa10ef3915e036f0eb24b4a2ad019f it says you may need to change the FindBin path on line 52 if you do not put the script at:

[EPRINTS_ROOT]/bin/local/delete_user

I would advise creating a local directory under your current
[EPRINTS_ROOT]/bin/ directory and moving the delete_user script there before re-running the command.

Regards

David Newman

On 13/12/2022 10:11 am, SGI Support | OST - Ostschweizer Fachhochschule via Eprints-tech wrote:
CAUTION: This e-mail originated outside the University of Southampton.

Hey Florian

Thank you for your support. I had downloaded delete_user from
https://eur03.safelinks.protection.outlook.com/?url="">
After I run this commad, I got on error:

eprints@eprints:~/bin$ ls -all
total 248
drwxr-xr-x  2 eprints www-data  4096 Dec 13 09:57 .
drwxr-xr-x 16 eprints www-data  4096 Dec 30  2020 ..
-rwxr-xr-x  1 eprints www-data 15838 Jul 17  2020 check_xapian
-rwxr-xr-x  1 eprints eprints   4519 Dec 13 09:57 delete_user
-rwxr-xr-x  1 eprints www-data 83031 Jul 17  2020 epadmin
-rwxr-xr-x  1 eprints www-data  4128 Jul 17  2020 epindexer
....
-rwxr-xr-x  1 eprints www-data  5363 Jul 17  2020 toolbox
-rwxr-xr-x  1 eprints www-data  1783 Jul 17  2020 unit_tests
eprints@eprints:~/bin$ ./delete_user hsr `for ((x=12; x<=13; x++)); { echo -n "$x "; }`
Can't locate EPrints.pm in @INC (you may need to install the EPrints module) (@INC contains: /usr/share/eprints/bin/../../perl_lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./delete_user line 54.
BEGIN failed--compilation aborted at ./delete_user line 54.
eprints@eprints:~/bin$

I use eprints 3.4.2, OS Ubuntu 20.04.4 LTS
Maybe you can help me further?

Greetings
Christian


-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.soton.ac.uk> On Behalf Of Florian Heß via Eprints-tech
Sent: Freitag, 9. Dezember 2022 11:03
To: eprints-tech@ecs.soton.ac.uk
Subject: Re: [EP-tech] How can i delete thousands of fake users?

CAUTION: This e-mail originated outside the University of Southampton.

Note xargs takes care of any limits opposed by the kernel concerning command line length. `xargs -a fake_users_ids.txt bin/delete_user REPOID` should do all fine.

Regards
F Hess

Am 09.12.22 um 02:34 schrieb David R Newman via Eprints-tech:
Hi Christian,

You could just add all the user IDs one after another to the
delete_user
script:

./delete_user REPO_ID `for ((x=5; x<=25590; x++)); { echo -n "$x "; }`

However, I suspect that command may be too long for bash (i.e. your
shell).  You could use xargs but you probably don't want to call the
delete_user script 25000+ times, as this will be slow compared to
calling it just a few times with multiple arguments. So it may be
better to write a bash script that passes 1000 user IDs at a time:

#!/bin/bash
for ((i=5;  i<=25590; i=i+1000)); do
    ./delete_user REPO_ID `for ((j=i; j<i+1000 && j<=25590; j++)); {
echo -n "$j "; }` done

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: https://eur03.safelinks.protection.outlook.com/?url="">
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url="">

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: https://eur03.safelinks.protection.outlook.com/?url="">
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url="">