paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ee9b3d04a77bbe98e3b5fdd748b3d61a8bd08045
parent fd7e864f799cf0a6d0d44fb8ee3bdf873fd8465e
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Fri, 22 Jan 2021 03:38:51 -0500

Remove unneeded scripts

Diffstat:
Dhttp/tuptime-update.pl | 61-------------------------------------------------------------
Dhttp/uploadwatch.sh | 9---------
2 files changed, 0 insertions(+), 70 deletions(-)

diff --git a/http/tuptime-update.pl b/http/tuptime-update.pl @@ -1,61 +0,0 @@ -#!/bin/perl - -use strict; -use warnings; -use HTML::TreeBuilder; -use File::Copy qw(copy move); - -# Copy about-site file so we can work on it without disturbing live copy -copy '/var/www/html/about-site.html', './about-site.html'; -my $outfile = './about-site.html.new'; -my $infile = './about-site.html'; - -# Open both infile and outfile for reading/writing respectively -open(my $fh, '<:encoding(UTF-8)', $infile) - or die "Could not open file '$infile' $!"; -open my $out, '>', "$outfile" or die "Can't write new file: $!"; - -# Run the tuptime command to get output for putting into outfile -my $cmd = "tuptime"; -my @output = `$cmd`; -chomp @output; - -# Look through each line of the infile, write the line to outfile unless we are -# in between <pre></pre> in which case write out the output of tuptime. -my $inPreFlag = 0; -my $arrIndex = 0; -while (my $row = <$fh>) { - chomp $row; - # Create a new HTML tree to parse HTML tags from $row - my $tr = HTML::TreeBuilder->new_from_content($row); - - # If this line contains a <pre> tag, set the proper flag to begin printing - # output from tuptime. - if ($tr->find_by_tag_name('pre')) { - $inPreFlag = 1; - print "Entering pre\n"; - print $out "<pre><code>"; - next; - } - # Check if we have printed out every line from the output of tuptime - if ($arrIndex == scalar @output) { - # Reset arrIndex so the above doesn't continue to resolve to true - $arrIndex = 0; - $inPreFlag = 0; - print "Exiting pre\n"; - print $out "</code></pre>\n"; - } - - if ($inPreFlag) { - print $out "$output[$arrIndex]\n"; - $arrIndex++; - } - else { - print $out "$row\n"; - } -} - -# Finally, overwrite the old about-site file with this new one: -move './about-site.html.new', '/var/www/html/about-site.html'; -# And remove the copy of the old one -unlink('./about-site.html'); diff --git a/http/uploadwatch.sh b/http/uploadwatch.sh @@ -1,9 +0,0 @@ -#!/bin/bash - -DESTDIR=/var/www/ -WATCHDIR=/home/manager/uploads/ - -mkdir -p "$WATCHDIR" -touch /home/manager/upload.log - -find "$WATCHDIR" -mindepth 1 -maxdepth 1 -exec sh -c 'if [ ! "$1" = "" ]; then echo "==========" >> /home/manager/upload.log && rsync -vr "$1" "$2" >> /home/manager/upload.log && rm -r $1 && chown -R www-data:www-data "$2"; fi' - {} "$DESTDIR" \;