-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python3 #192
base: python3
Are you sure you want to change the base?
Python3 #192
Changes from 12 commits
b6d2053
0bf9013
2b352e1
4a2c00c
ba3b6ab
66eb329
079d761
2a2dc70
cd47273
6633fc8
4dc9064
fa84132
f05a321
aff4765
91bc4ec
e06d83e
6a36c79
b9c8f50
cf5deeb
e23c136
ac4ed48
f1f2548
4a251b6
9617546
7f89b2d
914b09e
91b767c
1992a47
c8b1864
91c3e4e
8e8845e
169276e
781dacb
15c5fcc
a12cc11
072da2d
108928e
8cc2028
1e1ca4e
6487cb7
e13b98e
576238e
cf1e744
c6e4581
7f31f27
2c6ff44
8a1c664
5ffb18a
fba4690
3cc375a
e7baad4
8dfee5b
9ee63d6
d4142df
f43294f
a3b205a
9afc531
db9057d
92c1cce
422bbc3
e0aa548
df90112
e736bd5
62dad93
2e94072
ec390d9
3732562
2e52fa7
7794c9b
bbd453e
9387079
936764c
b73f91f
70d86c6
8883555
228331e
29db0b7
b5d9ae7
566254b
65e5d11
2f96e5c
d532232
61d09c3
fbf4653
020e6ef
c3e6f01
38b97d9
d33f8db
7a74b7f
2ac8c75
81d5977
96c993a
a584370
b215564
ad2a43e
42e5130
da233e9
6e57772
8ca44ca
471c4f8
95ecaa1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,16 @@ def handle(self, app, cmd): | |
elif cmd == 'ssh': | ||
subprocess.call(['systemctl', 'restart', 'ssh'], stderr=self.void) | ||
return self.jsonify({'ssh': True}) | ||
elif cmd == 'backup': | ||
subprocess.call(['tar', '-czf', '/boot/settings.tar.gz', '/root/photoframe_config'], stderr=self.void) | ||
return 'Backup Successful', 200 | ||
elif cmd == 'restore': | ||
if os.path.isfile("/boot/settings.tar.gz"): | ||
subprocess.call(['tar', '-xzf', '/boot/settings.tar.gz', '-C', '/'], stderr=self.void) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be done within the frame, since we're multi-threaded, instead it's better to have a tool that you kick off which will shutdown the frame service, update it and then restart it. This also gives us the option to add extra steps during import of older configurations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, the restore here does not remove the old configuration, so you run a big risk of getting a really jumbled setup after doing restore. One way to do restore without having downtime is to restore into |
||
subprocess.Popen('systemctl restart frame', shell=True) | ||
return 'Restore settings complete', 200 | ||
else: | ||
return 'No restore file found', 404 | ||
elif cmd == 'standby': | ||
self.timekeeper.setExternalStandby(True) | ||
return self.jsonify({'standby': self.timekeeper.getExternalStandby()}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts here. The backup should include some meta info, preferably a JSON file with the following details:
Complete folder path should also be avoided since we cannot assume /root/ will always be the destination (in the restore).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a risk that files change during export of configuration but I think it's less of a concern