Removed PIDfile nonsense, if you need a pid file, figure it out yourself
This commit is contained in:
12
README.md
12
README.md
@@ -1,2 +1,14 @@
|
|||||||
# transfer_scripts
|
# transfer_scripts
|
||||||
A few scripts for estimating size and transferring files
|
A few scripts for estimating size and transferring files
|
||||||
|
|
||||||
|
## Function
|
||||||
|
|
||||||
|
transfer.pl - Use rsync to copy over files in a list or directory.
|
||||||
|
|
||||||
|
estimate.pl - Estimate the total size of a list of files or a directory.
|
||||||
|
|
||||||
|
fixlist.sh - fix your file list to the format these programs expect
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
#
|
#
|
||||||
# Author: Elia Farin 2024
|
# Author: Elia Farin
|
||||||
# Written: 8/9/24
|
# Written: 8/9/24
|
||||||
# Modified: 8/9/24
|
# Modified: 8/9/24
|
||||||
# License: AGPL-3.0-or-later
|
# License: AGPL-3.0-or-later
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
if [ -z "${1}" ]; then
|
if [ -z "${1}" ]; then
|
||||||
echo "Usage: ${0} <filename>"
|
echo "Usage: ${0} <filename>"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
30
transfer.pl
30
transfer.pl
@@ -1,9 +1,4 @@
|
|||||||
#!/usr/local/bin/perl
|
#!/usr/local/bin/perl
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Getopt::Long;
|
|
||||||
use Proc::Pidfile;
|
|
||||||
|
|
||||||
# Transfer script transfer.pl
|
# Transfer script transfer.pl
|
||||||
# Author: Elia Farin
|
# Author: Elia Farin
|
||||||
# Written: 8/9/24
|
# Written: 8/9/24
|
||||||
@@ -25,25 +20,17 @@ use Proc::Pidfile;
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
my $pidfile;
|
use strict;
|
||||||
# if we are root, create a pidfile
|
use Getopt::Long;
|
||||||
if ($> = 0) {
|
use re;
|
||||||
my $pp = Proc::Pidfile->new( pidfile => "/var/run/transfer.pl.pid" );
|
my $username = getlogin() || (getpwuid($<))[0] || $ENV{LOGNAME} || $ENV{USER};
|
||||||
} else {
|
|
||||||
# if not, create our home pidfile
|
|
||||||
my $home = $ENV("$HOME");
|
|
||||||
my $pp = Proc::Pidfile->new( pidfile => "$home/transfer.pl.pid");
|
|
||||||
}
|
|
||||||
|
|
||||||
# die if we cannot get pidfile lock
|
|
||||||
$pidfile = $pp->$pidfile();
|
|
||||||
|
|
||||||
# sane defaults
|
# sane defaults
|
||||||
my $file = "";
|
my $file = "";
|
||||||
my $host = "192.168.42.100";
|
my $host = "";
|
||||||
my $directory = ".";
|
my $directory = ".";
|
||||||
my $user = "char";
|
my $user = $username;
|
||||||
my $dest= "/home/char/Downloads/";
|
my $dest= "/home/$username/Downloads/";
|
||||||
my $flags = "rvz";
|
my $flags = "rvz";
|
||||||
my $verbose;
|
my $verbose;
|
||||||
my $help;
|
my $help;
|
||||||
@@ -87,9 +74,6 @@ else {
|
|||||||
help();
|
help();
|
||||||
}
|
}
|
||||||
|
|
||||||
# remove the pidfile
|
|
||||||
undef $pp;
|
|
||||||
|
|
||||||
# help subroutine
|
# help subroutine
|
||||||
sub help {
|
sub help {
|
||||||
print "Usage: $ARGV[0] --file= --host= --directory= --user= --dest= --flags= [--verbose] [--help]\n
|
print "Usage: $ARGV[0] --file= --host= --directory= --user= --dest= --flags= [--verbose] [--help]\n
|
||||||
|
|||||||
Reference in New Issue
Block a user