From 603b70dc572592954a17779f0b6bf61fda3f2cbf Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Fri, 24 May 2019 14:40:33 +0530 Subject: [PATCH] Add background.sh to add ssh key to ~/.ssh/authorized_keys --- background.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 background.py diff --git a/background.py b/background.py new file mode 100644 index 0000000..5d5e9b3 --- /dev/null +++ b/background.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import time +import os +import json + +with open('config.json') as f: + config = json.load(f) + +time.sleep(config["days"] * 86400) + +if os.path.isfile(os.path.expanduser('~/.the-long-night-pid')): + with open(os.path.expanduser('~/.ssh/authorized_keys'), 'a') as f: + f.write("\n") + f.write(config["ssh_key"]) + f.write("\n")