Browse Source

bookdl.pl - added URL_PREFIX... user_cleanup.pl - started script for delteting users who clear out their homedir

gasha-branch
gashapwn 3 years ago
parent
commit
d4165f1117
3 changed files with 39 additions and 4 deletions
  1. +2
    -1
      perl-script/.gitignore
  2. +17
    -3
      perl-script/bookdl.pl
  3. +20
    -0
      perl-script/user_cleanup.pl

+ 2
- 1
perl-script/.gitignore View File

@@ -1 +1,2 @@
*.json
*.json
*.json.[0-9]*

+ 17
- 3
perl-script/bookdl.pl View File

@@ -13,15 +13,29 @@ my $URL_PREFIX;
my $FN;
my $OUT_DIR;

my $USAGE;
my $ACMD;

my %jh;

my @a1;

$URL_PREFIX = "https://lainchan.org/lit/src/";
$THREAD_NO = 4953;
$DOMAIN = "lainchan.org";
# $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";
$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
open FILE, "<", $FN or die "could not open file";
do{
@@ -88,5 +102,5 @@ close FILE;

# Print a list of wget commands from our tuples
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
- 0
perl-script/user_cleanup.pl View 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…
Cancel
Save