Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
98b41e0a
Commit
98b41e0a
authored
Nov 17, 2008
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a ReloadLog() function to reopen a logfile, as for newsyslog.
parent
99834c94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
tbsetup/libtestbed.pm.in
tbsetup/libtestbed.pm.in
+24
-10
No files found.
tbsetup/libtestbed.pm.in
View file @
98b41e0a
...
...
@@ -2,7 +2,7 @@
#
#
EMULAB
-
COPYRIGHT
#
Copyright
(
c
)
2000
-
200
7
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2000
-
200
8
University
of
Utah
and
the
Flux
Group
.
#
All
rights
reserved
.
#
...
...
@@ -20,7 +20,7 @@ use Exporter;
TBSCRIPTLOCK_IGNORE
TBSCRIPTLOCK_FAILED
PROJROOT
GROUPROOT
USERROOT
SCRATCHROOT
SHAREROOT
TBValidUserDir
TBValidUserDirList
TBMakeTempFile
NewUUID
System
SendProjAdminMail
);
SendProjAdminMail
ReOpenLog
);
@
EXPORT_OK
=
qw
(
TBMAIL_PROJADMIN
);
...
...
@@ -332,7 +332,7 @@ sub TBDebugTimeStampsOn()
#
sub TBBackGround($)
{
my($logname) = @_;
my
($logname) = @_;
my $mypid = fork();
if ($mypid) {
...
...
@@ -348,10 +348,30 @@ sub TBBackGround($)
open(STDIN, "< /dev/null") or
die("opening /dev/null for STDIN: $!");
ReOpenLog($logname);
#
# Create a new session to ensure we are clear of any process group
#
POSIX::setsid() or
die("setsid failed: $!");
return 0;
}
#
# As for newsyslog. Call this on signal. newsyslog will have renamed the
# the original file already.
#
sub ReOpenLog($)
{
my ($logname) = @_;
# Note different taint check (allow /).
if ($logname =~ /^([-\@\w.\/]+)$/) {
$logname = $1;
} else {
}
else {
die "Bad data in logfile name: $logname";
}
...
...
@@ -364,12 +384,6 @@ sub TBBackGround($)
STDOUT->autoflush(1);
STDERR->autoflush(1);
#
# Create a new session to ensure we are clear of any process group
#
POSIX::setsid() or
die("setsid failed: $!");
return 0;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment