add sudo for sym run
This commit is contained in:
@@ -4,7 +4,7 @@ class SymControlController < BaseController
|
|||||||
|
|
||||||
def run
|
def run
|
||||||
sym_path = "/home/yan/symmetric/"
|
sym_path = "/home/yan/symmetric/"
|
||||||
check_sym_proc_str = `#{"service SymmetricDS status"}`
|
check_sym_proc_str = `#{"sudo service SymmetricDS status"}`
|
||||||
# Check Sym Installed
|
# Check Sym Installed
|
||||||
# if sym_install_status[1] == "false"
|
# if sym_install_status[1] == "false"
|
||||||
# response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"}
|
# response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"}
|
||||||
@@ -12,15 +12,15 @@ class SymControlController < BaseController
|
|||||||
|
|
||||||
if check_sym_proc_str.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running"
|
if check_sym_proc_str.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running"
|
||||||
# Create Sym Table
|
# Create Sym Table
|
||||||
check_sym_table = system(sym_path + "bin/symadmin --engine sx create-sym-tables")
|
check_sym_table = system("sudo " + sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||||
if check_sym_table
|
if check_sym_table
|
||||||
sym_sql = Rails.root + "db/sym_master.sql"
|
sym_sql = Rails.root + "db/sym_master.sql"
|
||||||
|
|
||||||
if File.exist? (sym_sql)
|
if File.exist? (sym_sql)
|
||||||
# Import Sym Sql to db and start sym
|
# Import Sym Sql to db and start sym
|
||||||
run_sym_sql = system(sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
||||||
stop_sym = system("service SymmetricDS stop")
|
stop_sym = system("sudo service SymmetricDS stop")
|
||||||
run_sym = system("service SymmetricDS start")
|
run_sym = system("sudo service SymmetricDS start")
|
||||||
if run_sym
|
if run_sym
|
||||||
flash[:notice] = 'Success!'
|
flash[:notice] = 'Success!'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ class License
|
|||||||
# check_sym_proc_str = check_sym_proc_str.split("\n")
|
# check_sym_proc_str = check_sym_proc_str.split("\n")
|
||||||
# sym_install_status = check_sym_proc_str[0].split(": ")
|
# sym_install_status = check_sym_proc_str[0].split(": ")
|
||||||
|
|
||||||
check_sym_proc_str = `#{"service SymmetricDS status"}`
|
check_sym_proc_str = `#{"sudo service SymmetricDS status"}`
|
||||||
|
|
||||||
# Check Sym Installed
|
# Check Sym Installed
|
||||||
# if sym_install_status[1] == "false"
|
# if sym_install_status[1] == "false"
|
||||||
@@ -390,15 +390,15 @@ class License
|
|||||||
sym_run_status = check_sym_running(check_sym_proc_str, sym_path)
|
sym_run_status = check_sym_running(check_sym_proc_str, sym_path)
|
||||||
if sym_run_status
|
if sym_run_status
|
||||||
# Create Sym Table
|
# Create Sym Table
|
||||||
check_sym_table = system(sym_path + "bin/symadmin --engine sx create-sym-tables")
|
check_sym_table = system("sudo " + sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||||
if check_sym_table
|
if check_sym_table
|
||||||
sym_sql = Rails.root + "db/sym_master.sql"
|
sym_sql = Rails.root + "db/sym_master.sql"
|
||||||
|
|
||||||
if File.exist? (sym_sql)
|
if File.exist? (sym_sql)
|
||||||
# Import Sym Sql to db and start sym
|
# Import Sym Sql to db and start sym
|
||||||
run_sym_sql = system(sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
||||||
stop_sym = system("service SymmetricDS stop")
|
stop_sym = system("sudo service SymmetricDS stop")
|
||||||
run_sym = system("service SymmetricDS start")
|
run_sym = system("sudo service SymmetricDS start")
|
||||||
if run_sym
|
if run_sym
|
||||||
response = { "status": true, "message": "Activation is success and Configuration done..."}
|
response = { "status": true, "message": "Activation is success and Configuration done..."}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user