我正在运行 python 脚本来获取数据并将其放入数据库中,这在 Ubuntu 20.04 headless 上可能需要一天甚至更长的时间,如下所示:
stdbuf -o0 -e0 -i0 /path/v3_start_fetch.sh >> /path/logs/v3_cronlog_start_fetch__`date +\%Y\%m\%d\%H\%M\%S`___.log 2>&1 &
剧本:
. /path/env_project_auto/bin/activate
cd /path/working_scripts
python -u v3_updater_direct.py
每个异常也将被记录到 MySQL 数据库中。
问题:每次我运行任何脚本(我尝试了几个不同的脚本)时,它似乎都在完全相同的时间停止,即 23:36。有最后一个日志条目(每秒生成多个日志条目)。不管脚本是提前一小时还是 15 小时运行,停止时间总是相同的。
在系统日志中似乎有指向问题的可疑内容,但我无法理解它是什么,因为所有有关的条目Stopping User Manager for UUID xxx
似乎都与这样的 NVidia 启动问题有关,而这个问题没有得到解答。
日志条目:
Oct 30 23:25:01 torbenserver02 CRON[12977]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Oct 30 23:26:01 torbenserver02 CRON[12986]: (torben) CMD (echo "`date +%Y%m%d%H%M%S`: `dig +short torben.ddns.net`" >> /home/torben/Projects/ip.log)
Oct 30 23:26:08 torbenserver02 systemd[1]: session-975.scope: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[1]: Stopping User Manager for UID 1000...
Oct 30 23:26:18 torbenserver02 systemd[11289]: Stopped target Main User Target.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Stopped target Basic System.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Stopped target Paths.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Stopped target Sockets.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Stopped target Timers.
Oct 30 23:26:18 torbenserver02 systemd[11289]: dbus.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed D-Bus User Message Bus Socket.
Oct 30 23:26:18 torbenserver02 systemd[11289]: dirmngr.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed GnuPG network certificate management daemon.
Oct 30 23:26:18 torbenserver02 systemd[11289]: gpg-agent-browser.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed GnuPG cryptographic agent and passphrase cache (access for web browsers).
Oct 30 23:26:18 torbenserver02 systemd[11289]: gpg-agent-extra.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed GnuPG cryptographic agent and passphrase cache (restricted).
Oct 30 23:26:18 torbenserver02 systemd[11289]: gpg-agent-ssh.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed GnuPG cryptographic agent (ssh-agent emulation).
Oct 30 23:26:18 torbenserver02 systemd[11289]: gpg-agent.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed GnuPG cryptographic agent and passphrase cache.
Oct 30 23:26:18 torbenserver02 systemd[11289]: pk-debconf-helper.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed debconf communication socket.
Oct 30 23:26:18 torbenserver02 systemd[11289]: snapd.session-agent.socket: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Closed REST API socket for snapd user session agent.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Reached target Shutdown.
Oct 30 23:26:18 torbenserver02 systemd[11289]: systemd-exit.service: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Finished Exit the Session.
Oct 30 23:26:18 torbenserver02 systemd[11289]: Reached target Exit the Session.
Oct 30 23:26:18 torbenserver02 systemd[1]: [email protected]: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[1]: Stopped User Manager for UID 1000.
Oct 30 23:26:18 torbenserver02 systemd[1]: Stopping User Runtime Directory /run/user/1000...
Oct 30 23:26:18 torbenserver02 systemd[1]: run-user-1000.mount: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[1]: [email protected]: Succeeded.
Oct 30 23:26:18 torbenserver02 systemd[1]: Stopped User Runtime Directory /run/user/1000.
Oct 30 23:26:18 torbenserver02 systemd[1]: Removed slice User Slice of UID 1000.
Oct 30 23:27:01 torbenserver02 CRON[13038]: (torben) CMD (echo "`date +%Y%m%d%H%M%S`: `dig +short torben.ddns.net`" >> /home/torben/Projects/ip.log)
Oct 30 23:28:01 torbenserver02 CRON[13046]: (root) CMD ( test -x /etc/cron.daily/popularity-contest && /etc/cron.daily/popularity-contest --crond)
编辑数据库在本地运行,没有配置备份。在我关闭所有 SSH shell 之后,它似乎发生了任意时间,通常大约 1-2 小时。当我在这个周末的下午停止工作时,它发生在白天非常不同的时间。当我直接在机器上通过终端运行作业时,它似乎也不会发生。所以我做了这里描述的事情,并会尝试重现这个错误,看看它是否有帮助。