joininbox/scripts/scriptstarter.py

26 lines
869 B
Python
Raw Normal View History

2020-01-21 23:25:32 +00:00
#!/home/joinin/joinmarket-clientserver/jmvenv/bin/python
2020-01-20 01:03:09 +00:00
import subprocess
import sys
2020-01-21 13:18:19 +00:00
import os
2020-01-20 01:03:09 +00:00
SCRIPT = sys.argv[1]
WALLET = sys.argv[2]
2020-01-22 22:24:21 +00:00
f = open('/home/joinin/.pw','r')
2020-01-21 13:18:19 +00:00
PW = f.read().strip()
2020-01-20 01:03:09 +00:00
f.close()
2020-01-22 22:24:21 +00:00
os.system('rm -f /home/joinin/.pw')
2020-01-20 01:03:09 +00:00
2020-01-30 06:46:22 +00:00
logfile = open('%s.log' %SCRIPT, 'w')
process = subprocess.Popen(['torify', 'python', '/home/joinin/joinmarket-clientserver/scripts/%s.py' %SCRIPT,'%s.jmdat' %WALLET, '--wallet-password-stdin'],
2020-01-20 01:03:09 +00:00
stdin=subprocess.PIPE,
2020-01-30 06:46:22 +00:00
universal_newlines=True,
stderr=subprocess.STDOUT,
stdout=logfile)
2020-01-20 01:03:09 +00:00
process.stdin.write ("%s" %PW)
process.stdin.close()
2020-01-30 06:46:22 +00:00
process.wait()
logfile.close()