Explorar o código

update command trial

Jason %!s(int64=2) %!d(string=hai) anos
pai
achega
550ba31407
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      backstage/blogs/routes.py

+ 4 - 3
backstage/blogs/routes.py

@@ -7,6 +7,7 @@ import fnmatch
 import re
 import markdown
 import uuid
+import subprocess
 from backstage.blogs.forms import BlogCreateForm
 from backstage.utils import get_now_time, translate
 from backstage.utils.routes import create_content, remove_content, get_trans_title_url_name
@@ -136,9 +137,9 @@ image: ""\n
 
 @blogs_app.route('/backstage/update', methods=['GET'])
 def update():
-    stream = os.popen('/var/www/bhouse2/New-Bhouse-Web; hugo; rsync -azn -e ssh /var/www/bhouse2/New-Bhouse-Web/public root@172.105.241.163:/var/www/New-Bhouse-Web')
-    output = stream.read()
-    print(output)
+    #subprocess.run(["cp", "-r", "/var/www/bhouse2", "/var/www/bhousebackup"], shell=True)
+    subprocess.run(["cd /var/www/bhouse2/New-Bhouse-Web; hugo"], shell=True)
+    subprocess.run(["rsync", "-azn", "-e", "ssh", "/var/www/bhouse2/New-Bhouse-Web/public", "root@172.105.241.163:/var/www/New-Bhouse-Web"], shell=True) # remove n before handing to customer
     return redirect(url_for('blogs.blog_list'))
 
 @blogs_app.route('/backstage/blogs', methods=['GET'])