license updated

This commit is contained in:
Yan
2017-12-22 16:35:04 +06:30
parent da4af7bfc5
commit 11d9912401
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
class SymControlController < BaseController
skip_before_action :verify_authenticity_token
def run
sym_path = "/home/yan/symmetric/"
check_sym_proc_str = `#{"service SymmetricDS status"}`
# Check Sym Installed
# if sym_install_status[1] == "false"
# response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"}
# end
if check_sym_proc_str.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running"
# Create Sym Table
check_sym_table = system(sym_path + "bin/symadmin --engine sx create-sym-tables")
if check_sym_table
sym_sql = Rails.root + "db/sym_master.sql"
if File.exist? (sym_sql)
# Import Sym Sql to db and start sym
run_sym_sql = system(sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
stop_sym = system("service SymmetricDS stop")
run_sym = system("service SymmetricDS start")
if run_sym
render :text => "<h1>Success!</h1>"
end
else
render :text => "<h1>Sym Sql file not found!</h1>"
end
end
else
render :text => "<h1>Sym not running!</h1>"
end
end
end

View File

@@ -0,0 +1 @@