RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-395741

Антон Лебедев's questions

Martin Hope
Антон Лебедев
Asked: 2020-06-27 21:55:16 +0000 UTC

停止 Ubuntu Aws 上的用户会话

  • 0

再会。

Aws 上有一个 Ubuntu 实例。api 服务正在使用来自用户的 systemd 在其上运行。定期停止用户和相关服务的会话。

Jun 25 15:31:49 systemd-networkd[581]: eth0: Configured
Jun 25 15:31:49 systemd-timesyncd[449]: Network configuration changed, trying to establish connection.
Jun 25 15:31:49 systemd-timesyncd[449]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
Jun 25 15:37:55 systemd[1]: Starting Cleanup of Temporary Directories...
Jun 25 15:37:55 systemd[1]: Started Cleanup of Temporary Directories.
Jun 25 15:54:07 snapd[29375]: storehelpers.go:438: cannot refresh snap "amazon-ssm-agent": snap has no updates available
Jun 25 15:54:12 systemd[1]: Reloading.
Jun 25 15:54:12 systemd[1]: Starting Daily apt download activities...
Jun 25 15:54:12 systemd[1]: Mounting Mount unit for core, revision 9436...
Jun 25 15:54:12 systemd[1]: Mounted Mount unit for core, revision 9436.
Jun 25 15:54:14 systemd[1]: Started Daily apt download activities.
Jun 25 15:54:14 kernel: [3718687.245500] audit: type=1400 audit(1593100454.191:59): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/9436/usr/lib/snapd/snap-confine" pid=4420 comm="apparmor_parser"
Jun 25 15:54:14 kernel: [3718687.245865] audit: type=1400 audit(1593100454.191:60): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/9436/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=4420 comm="apparmor_parser"
Jun 25 15:54:14 kernel: [3718687.380157] audit: type=1400 audit(1593100454.323:61): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.core.hook.configure" pid=4466 comm="apparmor_parser"
Jun 25 15:54:14 kernel: [3718687.387060] audit: type=1400 audit(1593100454.331:62): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.core" pid=4469 comm="apparmor_parser"
Jun 25 15:54:14 snapd[29375]: daemon.go:542: gracefully waiting for running hooks
Jun 25 15:54:14 snapd[29375]: daemon.go:544: done waiting for running hooks
Jun 25 15:54:14 systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Jun 25 15:54:14 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 4.
Jun 25 15:54:14 systemd[1]: Stopped Snappy daemon.
Jun 25 15:54:14 systemd[1]: Starting Snappy daemon...
Jun 25 15:54:15 snapd[4483]: AppArmor status: apparmor is enabled and all features are available
Jun 25 15:54:15 snapd[4483]: AppArmor status: apparmor is enabled and all features are available
Jun 25 15:54:15 snapd[4483]: patch.go:64: Patching system state level 6 to sublevel 1...
Jun 25 15:54:15 snapd[4483]: patch.go:64: Patching system state level 6 to sublevel 2...
Jun 25 15:54:15 snapd[4483]: patch.go:64: Patching system state level 6 to sublevel 3...
Jun 25 15:54:15 snapd[4483]: daemon.go:343: started snapd/2.45.1 (series 16; classic) ubuntu/18.04 (amd64) linux/4.15.0-1065-aws.
Jun 25 15:54:15 snapd[4483]: daemon.go:436: adjusting startup timeout by 40s (pessimistic estimate of 30s plus 5s per snap)
Jun 25 15:54:16 kernel: [3718689.181896] audit: type=1400 audit(1593100456.127:63): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/snap/core/9436/usr/lib/snapd/snap-confine" pid=4553 comm="apparmor_parser"
Jun 25 15:54:16 kernel: [3718689.182052] audit: type=1400 audit(1593100456.127:64): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/snap/core/9436/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=4553 comm="apparmor_parser"
Jun 25 15:54:16 kernel: [3718689.212835] audit: type=1400 audit(1593100456.159:65): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.amazon-ssm-agent" pid=4555 comm="apparmor_parser"
Jun 25 15:54:16 kernel: [3718689.222505] audit: type=1400 audit(1593100456.167:66): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.core" pid=4556 comm="apparmor_parser"
Jun 25 15:54:16 kernel: [3718689.300833] audit: type=1400 audit(1593100456.247:67): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.core.hook.configure" pid=4557 comm="apparmor_parser"
Jun 25 15:54:16 kernel: [3718689.305021] audit: type=1400 audit(1593100456.251:68): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.amazon-ssm-agent.amazon-ssm-agent" pid=4559 comm="apparmor_parser"
Jun 25 15:54:16 systemd[1]: Started Snappy daemon.
Jun 25 15:54:17 systemd[1]: Reloading.
Jun 25 15:54:18 snapd[4483]: storehelpers.go:438: cannot refresh snap "core": snap has no updates available
Jun 25 16:01:48 systemd-networkd[581]: eth0: Configured
Jun 25 16:01:48 systemd-timesyncd[449]: Network configuration changed, trying to establish connection.
Jun 25 16:01:48 systemd-timesyncd[449]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
Jun 25 16:12:11 systemd[1]: Stopping User Manager for UID 1000...
Jun 25 16:12:11 systemd[18795]: Stopped target Default.
Jun 25 16:12:11 systemd[18795]: Stopping API_SERVICE...
Jun 25 16:12:11 systemd[18795]: Stopped API_SERVICE.
Jun 25 16:12:11 systemd[18795]: Stopped target Basic System. 
Jun 25 16:12:11 systemd[18795]: Stopped target Sockets. 
Jun 25 16:12:11 systemd[18795]: Closed GnuPG cryptographic agent and passphrase cache. 
Jun 25 16:12:11 systemd[18795]: Closed REST API socket for snapd user session agent. 
Jun 25 16:12:11 systemd[18795]: Closed GnuPG cryptographic agent and passphrase cache (restricted). 
Jun 25 16:12:11 systemd[18795]: Closed GnuPG cryptographic agent (ssh-agent emulation). 
Jun 25 16:12:11 systemd[18795]: Closed GnuPG network certificate management daemon. 
Jun 25 16:12:11 systemd[18795]: Closed GnuPG cryptographic agent and passphrase cache (access for web browsers). 
Jun 25 16:12:11 systemd[18795]: Stopped target Timers. 
Jun 25 16:12:11 systemd[18795]: Stopped target Paths. 
Jun 25 16:12:11 systemd[18795]: Reached target Shutdown. 
Jun 25 16:12:11 systemd[18795]: Starting Exit the Session... 
Jun 25 16:12:11 systemd[18795]: Received SIGRTMIN+24 from PID 5414 (kill). 
Jun 25 16:12:11 systemd[1]: Stopped User Manager for UID 1000. 
Jun 25 16:12:11 systemd[1]: Removed slice User Slice of API_USER. 
Jun 25 16:17:01 CRON[5416]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly) 
Jun 25 16:31:49 systemd-timesyncd[449]: Network configuration changed, trying to establish connection. 
Jun 25 16:31:49 systemd-networkd[581]: eth0: Configured 
Jun 25 16:31:49 systemd-timesyncd[449]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).

之后,不会启动用户会话。但是如果你尝试向这个服务的 api 发出请求,那么用户会话和服务都会被启动。

Jun 26 11:31:28 systemd-networkd[581]: eth0: Configured 
Jun 26 11:31:28 systemd-timesyncd[449]: Network configuration changed, trying to establish connection. 
Jun 26 11:31:28 systemd-timesyncd[449]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com). 
Jun 26 11:32:37 systemd[1]: Created slice User Slice of API_USER. 
Jun 26 11:32:37 systemd[1]: Starting User Manager for UID 1000... 
Jun 26 11:32:37 systemd[1]: Started Session 1208 of user API_USER. 
Jun 26 11:32:37 systemd[6860]: /home/API_USER/.config/systemd/user/API_SERVICE.service:8: Failed to parse service type, ignoring: Simple
Jun 26 11:32:37 systemd[6860]: Listening on GnuPG network certificate management daemon. 
Jun 26 11:32:37 systemd[6860]: Listening on REST API socket for snapd user session agent. 
Jun 26 11:32:37 systemd[6860]: Reached target Timers. 
Jun 26 11:32:37 systemd[6860]: Listening on GnuPG cryptographic agent and passphrase cache (access for web browsers). 
Jun 26 11:32:37 systemd[6860]: Listening on GnuPG cryptographic agent and passphrase cache (restricted). 
Jun 26 11:32:37 systemd[6860]: Listening on GnuPG cryptographic agent (ssh-agent emulation). 
Jun 26 11:32:37 systemd[6860]: Listening on GnuPG cryptographic agent and passphrase cache. 
Jun 26 11:32:37 systemd[6860]: Reached target Sockets. 
Jun 26 11:32:37 systemd[6860]: Reached target Paths. 
Jun 26 11:32:37 systemd[6860]: Reached target Basic System. 
Jun 26 11:32:37 systemd[1]: Started User Manager for UID 1000. 
Jun 26 11:32:37 systemd[6860]: Started API_SERVICE. 
Jun 26 11:32:37 systemd[6860]: Reached target Default. 
Jun 26 11:32:37 systemd[6860]: Startup finished in 53ms. 
Jun 26 11:32:38 API_SERVICE[6873]: API_SERVICE_LOG
  1. 为什么用户的会话停止了?
  2. 如何预防?

升级版:

ASP.NET 核心

[Unit]
Description={SERVICE_NAME}
After=network.target
StartLimitIntervalSec=0

[Service]
WorkingDirectory=/home/{SERVICE_WD_PATH}
Type=Simple
Restart=always
RestartSec=5
ExecStart=/home/{SERVICE_PATH}
KillSignal=SIGINT
SyslogIdentifier={SERVICE_ID}

[Install]
WantedBy=default.target
asp.net-core
  • 2 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5