Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: session_manager_service.cc

Issue 5184005: login_manager: Add dbus API for restarting entd when enterprise extensions installed (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: Respond to cmasone review Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « session_manager_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: session_manager_service.cc
diff --git a/session_manager_service.cc b/session_manager_service.cc
index 09e21fb206ca0f2c002a8d5da5af5b6340e2b055..20c1218d75d55730720029b3c8dc04c9dd99b4e8 100644
--- a/session_manager_service.cc
+++ b/session_manager_service.cc
@@ -634,6 +634,26 @@ gboolean SessionManagerService::RestartJob(gint pid,
OUT_done, error);
}
+gboolean SessionManagerService::RestartEntd(GError** error) {
+ LOG(INFO) << "Restarting entd.";
+ // Shutdown entd if it is currently running, blocking this thread and
+ // method call until it has finished shutting down.
+ int stop_status = system("/sbin/initctl stop entd");
+ // Stop may have failed, but it may be ok if not already running. Error
+ // messages will go to session manager log.
+ LOG_IF(INFO, stop_status != 0)
+ << "Could not stop entd, likely was not running.";
+ string command = StringPrintf("/sbin/initctl start entd "
+ "CHROMEOS_USER=%s",
+ current_user_.c_str());
+ // Start entd with the current user passed in, blocking this thread
+ // and method call until it has finished starting.
+ bool restarted = (system(command.c_str()) == 0);
+ LOG(INFO) << "Restart was " << (restarted ? "" : "not ")
+ << "successful.";
+ return restarted;
+}
+
///////////////////////////////////////////////////////////////////////////////
// glib event handlers
« no previous file with comments | « session_manager_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698