Created
October 29, 2017 09:46
-
-
Save tsu-nera/1520ecec722790f7ccd353fa7900b2a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
import subprocess | |
import time | |
exec_path = "/home/tsu-nera/tmp/a.out" | |
core_path = "/home/tsu-nera/tmp/core" | |
bt_path = "/home/tsu-nera/tmp/backtrace" | |
core_time = subprocess.check_output(['ls', '-l', core_path]).split() | |
bt_time = subprocess.check_output(['ls', '-l', bt_path]).split() | |
core_time_p = time.strptime(core_time[7], "%H:%M") | |
bt_time_p = time.strptime(bt_time[7], "%H:%M") | |
if core_time_p > bt_time_p: | |
with open(bt_path, 'w') as f: | |
subprocess.call(['gdb', '-q', '-n', '-ex', 'bt', '-batch', | |
exec_path, core_path], stdout=f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[Unit]
Description=get backtrace
After=syslog.target
[Service]
Type=oneshot
ExecStart=/usr/bin/bt.py
[Install]
WantedBy=multi-user.target