From ec31e8f56765ee6772f2ac65d68609800ccc1ecc Mon Sep 17 00:00:00 2001 From: battilo Date: Sun, 17 Sep 2017 12:07:11 +0200 Subject: [PATCH] start ver --- SetupNewComp.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 SetupNewComp.pl diff --git a/SetupNewComp.pl b/SetupNewComp.pl new file mode 100755 index 0000000..750b4ad --- /dev/null +++ b/SetupNewComp.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl +use warnings; +use strict; +#use DBI; +#use Passwd::Linux qw(modpwinfo setpwinfo rmpwnam mgetpwnam); +use Data::Dumper qw(Dumper); + +sub getTimeStamp { # parm [ts] => timestamp for filename; log => timestamp for log + my $format = "%04d%02d%02d%02d%02d%02d"; + my ($p1) = @_; + if (defined $p1 and $p1 eq "log") { + $format = "%04d%02d%02d %02d:%02d:%02d"; + } + if (defined $p1 and $p1 eq "db_ts") { + $format = "%04d-%02d-%02d %02d:%02d:%02d"; + } + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + my $timestamp = sprintf ( $format, $year+1900,$mon+1,$mday,$hour,$min,$sec); + return $timestamp; +} +print getTimeStamp("log") . " - pid $$ >> Execution started.\n"; + +my @info = getpwnam('alex'); +print Dumper \@info; + + +print getTimeStamp("log") . " - pid $$ >> Execution ended.\n"; +exit;