Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
truenas-rk3588
truenas
Commits
ff1fe0fc
Commit
ff1fe0fc
authored
4 years ago
by
William Grzybowski
Browse files
Options
Download
Email Patches
Plain Diff
Remove core files after setting up system dataset
Ticket: NAS-109454 (cherry picked from commit
325ecdb7
)
parent
4ccb5bd9
truenas/12.0-u2-stable
TN-12.0-U2.1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/middlewared/middlewared/plugins/sysdataset.py
+9
-0
src/middlewared/middlewared/plugins/sysdataset.py
src/middlewared/middlewared/plugins/system.py
+0
-8
src/middlewared/middlewared/plugins/system.py
with
9 additions
and
8 deletions
+9
-8
src/middlewared/middlewared/plugins/sysdataset.py
View file @
ff1fe0fc
...
...
@@ -8,6 +8,7 @@ import errno
import
os
import
shutil
import
uuid
from
pathlib
import
Path
SYSDATASET_PATH
=
'/var/db/system'
...
...
@@ -289,6 +290,14 @@ class SystemDatasetService(ConfigService):
await
run
(
'sysctl'
,
f
"kern.corefile='
{
corepath
}
/%N.core'"
)
os
.
chmod
(
corepath
,
0o775
)
if
await
self
.
middleware
.
call
(
'keyvalue.get'
,
'run_migration'
,
False
):
try
:
cores
=
Path
(
corepath
)
for
corefile
in
cores
.
iterdir
():
corefile
.
unlink
()
except
Exception
:
self
.
logger
.
warning
(
"Failed to clear old core files."
,
exc_info
=
True
)
await
self
.
__nfsv4link
(
config
)
await
self
.
middleware
.
call
(
'smb.setup_directories'
)
# The following should be backgrounded since they may be quite
...
...
This diff is collapsed.
Click to expand it.
src/middlewared/middlewared/plugins/system.py
View file @
ff1fe0fc
import
asyncio
from
datetime
import
datetime
,
date
,
timezone
from
pathlib
import
Path
from
middlewared.event
import
EventSource
from
middlewared.i18n
import
set_language
from
middlewared.logger
import
CrashReporting
...
...
@@ -1681,12 +1680,5 @@ async def setup(middleware):
CRASH_DIR
=
'/data/crash'
os
.
makedirs
(
CRASH_DIR
,
exist_ok
=
True
)
os
.
chmod
(
CRASH_DIR
,
0o775
)
if
await
middleware
.
call
(
'keyvalue.get'
,
'run_migration'
,
False
):
try
:
cores
=
Path
(
"/var/db/system/cores"
)
for
corefile
in
cores
.
iterdir
():
corefile
.
unlink
()
except
Exception
:
self
.
logger
.
warning
(
"Failed to clear old core files."
,
exc_info
=
True
)
middleware
.
register_hook
(
'system.post_license_update'
,
hook_license_update
,
sync
=
False
)
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help