start ver
This commit is contained in:
28
SetupNewComp.pl
Executable file
28
SetupNewComp.pl
Executable file
@@ -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;
|
||||
Reference in New Issue
Block a user