diff --git a/app/controllers/sym_control_controller.rb b/app/controllers/sym_control_controller.rb index 9b7a7a66..bbd4a087 100644 --- a/app/controllers/sym_control_controller.rb +++ b/app/controllers/sym_control_controller.rb @@ -4,7 +4,7 @@ class SymControlController < BaseController def run sym_path = "/home/yan/symmetric/" - check_sym_proc_str = `#{"service SymmetricDS status"}` + check_sym_proc_str = `#{"sudo 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!"} @@ -12,15 +12,15 @@ class SymControlController < BaseController 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") + check_sym_table = system("sudo " + 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") + run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s) + stop_sym = system("sudo service SymmetricDS stop") + run_sym = system("sudo service SymmetricDS start") if run_sym flash[:notice] = 'Success!' end diff --git a/app/models/license.rb b/app/models/license.rb index 7732d764..8c22f478 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -379,7 +379,7 @@ class License # check_sym_proc_str = check_sym_proc_str.split("\n") # 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 # if sym_install_status[1] == "false" @@ -390,15 +390,15 @@ class License sym_run_status = check_sym_running(check_sym_proc_str, sym_path) if sym_run_status # 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 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") + run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s) + stop_sym = system("sudo service SymmetricDS stop") + run_sym = system("sudo service SymmetricDS start") if run_sym response = { "status": true, "message": "Activation is success and Configuration done..."} end