我的预定作业如此运行:
#!/usr/bin/env python
import datetime, schedule, time
from messager.send_texts import send_text
from messager.send_emails import send_email
from data.tasks import TASKS, TEXT_PREMESSAGE
DAYS = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
LUNCH_TIMES = ['17:00'] # 12pm
NIGHT_TIMES = ['02:00'] # 9pm
def get_tasks_text_message():
return TEXT_PREMESSAGE + "\n\n" + TASKS
def schedule_reminders(days, times, schedule_package):
for day in days:
for time in times:
getattr(schedule.every(), day).at(time).do(send_email, subject="Do your tasks!", body=TASKS).tag('tasks')
getattr(schedule.every(), day).at(time).do(
send_text,
body=get_tasks_text_message(),
target_phone_number='+15127365653'
).tag('tasks')
if __name__ == '__main__':
# M-Th at lunch
schedule_reminders(DAYS[0:4], LUNCH_TIMES, schedule)
# M/W when I'm home from gym
schedule_reminders(DAYS[1:2], NIGHT_TIMES, schedule) # tuesday 2am is monday 9pm
schedule_reminders(DAYS[3:4], NIGHT_TIMES, schedule) # thursday 2am is wednesday 9pm
# Sa when I'm home from gym
schedule_reminders(DAYS[5:6], ['22:30'], schedule)
# Su when I'm home reading
schedule_reminders(DAYS[6:7], ['17:00'], schedule)
while True:
""" Prove how to clear the schedule...
https://schedule.readthedocs.io/en/stable/faq.html#clear-job-by-tag
"""
# you can clear tasks if you give them a tag using .tag('tag-name')...
# schedule.clear('tasks')
# schedule.clear('id_23')
now = datetime.datetime.now()
print(now)
schedule.run_pending()
time.sleep(60)
代码位于https://bitbucket.org/codyc54321/virtual_assistant
当我运行它时,它会工作一次,然后死亡只说“被杀”。我没有得到进一步的信息
我看到/var/log/kern.log
:
Jul 4 05:32:38 virtual-assistant kernel: [ 7.681842] xor: automatically using best checksumming function:
Jul 4 05:32:38 virtual-assistant kernel: [ 7.724039] avx : 8469.000 MB/sec
Jul 4 05:32:38 virtual-assistant kernel: [ 7.730950] async_tx: api initialized (async)
Jul 4 05:32:38 virtual-assistant kernel: [ 7.764063] md: raid6 personality registered for level 6
Jul 4 05:32:38 virtual-assistant kernel: [ 7.766609] md: raid5 personality registered for level 5
Jul 4 05:32:38 virtual-assistant kernel: [ 7.768985] md: raid4 personality registered for level 4
Jul 4 05:32:38 virtual-assistant kernel: [ 7.785045] md: raid10 personality registered for level 10
Jul 4 05:32:38 virtual-assistant kernel: [ 7.866145] Btrfs loaded
Jul 4 05:32:38 virtual-assistant kernel: [ 7.906183] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
Jul 4 05:32:38 virtual-assistant kernel: [ 8.366340] Loading iSCSI transport class v2.0-870.
Jul 4 05:32:38 virtual-assistant kernel: [ 8.422214] EXT4-fs (vda1): re-mounted. Opts: (null)
Jul 4 05:32:38 virtual-assistant kernel: [ 8.464942] iscsi: registered transport (tcp)
Jul 4 05:32:38 virtual-assistant kernel: [ 9.051867] iscsi: registered transport (iser)
Jul 4 05:32:38 virtual-assistant kernel: [ 12.303381] audit: type=1400 audit(1499146352.764:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lxc-container-default" pid=769 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 12.304812] audit: type=1400 audit(1499146352.768:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lxc-container-default-cgns" pid=769 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 12.312284] audit: type=1400 audit(1499146352.776:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lxc-container-default-with-mounting" pid=769 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 12.314252] audit: type=1400 audit(1499146352.776:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lxc-container-default-with-nesting" pid=769 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 13.331096] audit: type=1400 audit(1499146353.792:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/sbin/dhclient" pid=809 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 13.333858] audit: type=1400 audit(1499146353.796:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=809 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 13.336588] audit: type=1400 audit(1499146353.800:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=809 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 13.337167] audit: type=1400 audit(1499146353.800:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/connman/scripts/dhclient-script" pid=809 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 13.378712] audit: type=1400 audit(1499146353.840:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/lxc-start" pid=874 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 13.505436] ppdev: user-space parallel port driver
Jul 4 05:32:38 virtual-assistant kernel: [ 13.653885] virtio_net virtio0 eth0: renamed from ens3
Jul 4 05:32:38 virtual-assistant kernel: [ 13.731609] audit: type=1400 audit(1499146354.192:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/lxd/lxd-bridge-proxy" pid=879 comm="apparmor_parser"
Jul 4 05:32:38 virtual-assistant kernel: [ 16.761538] EXT4-fs (vda1): resizing filesystem from 576000 to 5242619 blocks
Jul 4 05:32:38 virtual-assistant kernel: [ 16.778647] EXT4-fs (vda1): resized filesystem to 5242619
Jul 4 05:32:38 virtual-assistant kernel: [ 17.549292] cgroup: new mount options do not match the existing superblock, will be ignored
Jul 4 05:32:48 virtual-assistant kernel: [ 27.862032] random: nonblocking pool is initialized
这个应用程序在本地工作,我只收到一个文本和电子邮件。我只是将我的client_secret.json
移到了服务器上,但也没有解决它。
root@virtual-assistant:~# grep -E -in 'oom|kill' /var/log/*
grep: /var/log/apt: Is a directory
grep: /var/log/dist-upgrade: Is a directory
grep: /var/log/fsck: Is a directory
grep: /var/log/lxd: Is a directory
/var/log/syslog:543:Jul 4 05:32:38 virtual-assistant systemd[1]: Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
grep: /var/log/unattended-upgrades: Is a directory
当我只收到1个字的反馈时,如何通过写入日志来解决这个问题?另一位用户表示,APS的错误信息完全一样糟糕(“被杀”)。谢谢