Linux + очистка файлов и папок в /tmp

Просто отвечу на свой вопрос, на случай, если кто-то еще столкнется с той же проблемой.

Вы можете либо назначить переменную PS1 в / etc / bashrc для всех пользователей, либо закомментировать и использовать / .bash_profile для отдельной учетной записи. В моем случае / .bash_profile уже был настроен, и все, что мне нужно было сделать, это отключить PS1 в / etc / bashrc .

См. Следующий снимок экрана. После модификации перезагрузитесь или снова ssh. Обратите внимание на комментарии, оставленные разработчиками cPanel.

enter image description here

Большое спасибо Slyx и всем за их ценные ответы.

4
20.12.2018, 08:59
2 ответа

Вы можете спросить systemd, какие у юнита триггеры:

systemctl show -p TriggeredBy systemd-tmpfiles-clean

Это покажет, что служба systemd-tmpfiles-cleanзапускается таймером systemd-tmpfiles-clean.timer. Это определяется как

#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Daily Cleanup of Temporary Directories
Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)

[Timer]
OnBootSec=15min
OnUnitActiveSec=1d

Таким образом, служба запускается каждый день и очищает каталоги на основе конфигурации tmpfiles.d. Подробности смотрите на соответствующих справочных страницах.

12
27.01.2020, 20:45

systemd-tmpfiles-clean.serviceинициируется systemd-tmpfiles-clean.timer. Вы можете проверить таймеры с помощью systemctl list-timers.

По крайней мере, в Ubuntu 16.04 systemd-tmpfiles-clean.timerопределяется как

# Use `systemctl cat systemd-tmpfiles-clean.timer` to get your corresponding file
#
# /lib/systemd/system/systemd-tmpfiles-clean.timer
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
[Unit]
Description=Daily Cleanup of Temporary Directories
Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)

[Timer]
OnBootSec=15min
OnUnitActiveSec=1d

Таким образом, таймер запускается systemd-tmpfiles-clean.serviceчерез 15 минут после загрузки, а затем каждые 24 часа.

Для получения дополнительной информации см. systemd.timer(5), systemd.service(5)и systemd.unit(5).

6
27.01.2020, 20:45

Теги

Похожие вопросы