bookdl.pl - added URL_PREFIX... user_cleanup.pl - started script for delteting users who clear out their homedir
This commit is contained in:
parent
4cccba22de
commit
d4165f1117
3
perl-script/.gitignore
vendored
3
perl-script/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
*.json
|
*.json
|
||||||
|
*.json.[0-9]*
|
@ -13,15 +13,29 @@ my $URL_PREFIX;
|
|||||||
my $FN;
|
my $FN;
|
||||||
my $OUT_DIR;
|
my $OUT_DIR;
|
||||||
|
|
||||||
|
my $USAGE;
|
||||||
|
my $ACMD;
|
||||||
|
|
||||||
my %jh;
|
my %jh;
|
||||||
|
|
||||||
my @a1;
|
my @a1;
|
||||||
|
|
||||||
$URL_PREFIX = "https://lainchan.org/lit/src/";
|
$DOMAIN = "lainchan.org";
|
||||||
$THREAD_NO = 4953;
|
# $URL_PREFIX = "https://lainchan.org/lit/src/";
|
||||||
|
$URL_PREFIX = "https://$DOMAIN/lit/src/";
|
||||||
|
$THREAD_NO = 4619;
|
||||||
|
# $THREAD_NO = 6105;
|
||||||
|
# $THREAD_NO = 4345;
|
||||||
|
# $THREAD_NO = 4953;
|
||||||
$FN = "$THREAD_NO.json";
|
$FN = "$THREAD_NO.json";
|
||||||
$OUT_DIR = "./dl/";
|
$OUT_DIR = "./dl/";
|
||||||
|
|
||||||
|
|
||||||
|
$USAGE = "Usage: bookdl.pl [http://someurl/]thread_id";
|
||||||
|
|
||||||
|
die "$USAGE" unless scalar @ARGV > 0;
|
||||||
|
$ACMD = $ARGV[0];
|
||||||
|
|
||||||
# Read JSON with list of files
|
# Read JSON with list of files
|
||||||
open FILE, "<", $FN or die "could not open file";
|
open FILE, "<", $FN or die "could not open file";
|
||||||
do{
|
do{
|
||||||
@ -88,5 +102,5 @@ close FILE;
|
|||||||
|
|
||||||
# Print a list of wget commands from our tuples
|
# Print a list of wget commands from our tuples
|
||||||
for my $i1 (@a1){
|
for my $i1 (@a1){
|
||||||
printf("wget -N %s -O '%s%s'\n", scalar $i1->[1], $OUT_DIR, scalar $i1->[0]);
|
printf("wget -nc %s -O '%s%s'\n", scalar $i1->[1], $OUT_DIR, scalar $i1->[0]);
|
||||||
}
|
}
|
||||||
|
20
perl-script/user_cleanup.pl
Normal file
20
perl-script/user_cleanup.pl
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
my $fn;
|
||||||
|
my $cmd_out;
|
||||||
|
|
||||||
|
$fn = "/tilde/lyadmin/user_list.txt";
|
||||||
|
|
||||||
|
open FILE, "<", $fn or die "could not open $fn";
|
||||||
|
|
||||||
|
$cmd_out = `ls /home`;
|
||||||
|
chomp $cmd_out;
|
||||||
|
|
||||||
|
while(<FILE>){
|
||||||
|
chomp;
|
||||||
|
`userdel $_` unless($cmd_out =~ /$_/);
|
||||||
|
}
|
||||||
|
close FILE;
|
Loading…
Reference in New Issue
Block a user