Files
ase_perl/SetupNewComp.pl
2017-09-17 12:07:11 +02:00

29 lines
819 B
Perl
Executable File

#!/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;