aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-26 14:54:43 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-26 14:54:43 +0200
commitc482f11c410d1fa5a266920d570fca8922ae4eae (patch)
treef40a832f8e9145cdde7ecc924bfbb67c5b5addcb
parentMissing . here (diff)
downloadjoe-scripts-c482f11c410d1fa5a266920d570fca8922ae4eae.tar.gz
joe-scripts-c482f11c410d1fa5a266920d570fca8922ae4eae.tar.bz2
joe-scripts-c482f11c410d1fa5a266920d570fca8922ae4eae.tar.xz
joe-scripts-c482f11c410d1fa5a266920d570fca8922ae4eae.tar.zst
joe-scripts-c482f11c410d1fa5a266920d570fca8922ae4eae.zip
Better vps-do script
-rwxr-xr-xvps-do.pl15
1 files changed, 7 insertions, 8 deletions
diff --git a/vps-do.pl b/vps-do.pl
index 60740cd..0c7410a 100755
--- a/vps-do.pl
+++ b/vps-do.pl
@@ -3,6 +3,8 @@
use strict;
use warnings;
use Term::ANSIColor;
+use constant SCRIPTS_DIR => '/root/scripts/src/';
+use constant SSH_BOY => 'root@jozanleclerc.xyz';
sub main {
my $argc = $#ARGV + 1;
@@ -12,10 +14,7 @@ sub main {
. colored("[script-invoke - (argument(s))]\n", 'bold');
exit 1;
}
- my $scripts_dir = '/root/scripts/src/';
my $called_script = '';
- my $word = '';
- my $ssh_boy = 'root@jozanleclerc.xyz';
my $argv_line = '';
if (
$ARGV[0] eq 'addsshkey' ||
@@ -26,15 +25,15 @@ sub main {
$ARGV[0] eq 'rmrepo' ||
$ARGV[0] eq 'rmuser'
) {
- $called_script = $scripts_dir . 'gitjoe/' . $ARGV[0] . '.pl';
+ $called_script = SCRIPTS_DIR . 'gitjoe/' . $ARGV[0] . '.pl';
}
elsif (
$ARGV[0] eq "update-gitjoe" ||
$ARGV[0] eq "update-vps"
) {
- $word = $ARGV[0];
+ my $word = $ARGV[0];
$word =~ s/update-//;
- $called_script = $scripts_dir . 'update/' . $word . '.pl';
+ $called_script = SCRIPTS_DIR . 'update/' . $word . '.pl';
}
else {
print colored("Failed!\n", 'bold red')
@@ -51,7 +50,7 @@ sub main {
. colored("update-vps\n", 'bold green');
exit 2;
}
- print "Calling " . colored($called_script, 'bold green') . " via " . colored($ssh_boy, 'bold magenta') . ".\n";
+ print "Calling " . colored($called_script, 'bold green') . " via " . colored(SSH_BOY, 'bold magenta') . ".\n";
if ($argc > 1) {
print "Arguments:\n";
my $i = 1;
@@ -66,7 +65,7 @@ sub main {
system(
$dash,
'-c',
- 'ssh ' . $ssh_boy . " << EOF
+ 'ssh ' . SSH_BOY . " << EOF
" . $called_script . $argv_line . "
exit
EOF