user-sessions.c revision e92787416c691c3f34f47349e5eae3fa68eae856
d657c51f14601d0235434ffb78cf6ac0f27cc83cLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering This file is part of systemd.
b72ddf0f4f552dd53d6404b6ddbc9f17d02b8e12Kay Sievers Copyright 2010 Lennart Poettering
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering systemd is free software; you can redistribute it and/or modify it
b72ddf0f4f552dd53d6404b6ddbc9f17d02b8e12Kay Sievers under the terms of the GNU General Public License as published by
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering the Free Software Foundation; either version 2 of the License, or
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering (at your option) any later version.
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering systemd is distributed in the hope that it will be useful, but
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering General Public License for more details.
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering You should have received a copy of the GNU General Public License
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering log_error("This program requires one argument.");
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering log_error("Failed to remove nologin files: %m");
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering if ((r = write_one_line_file("/var/run/nologin", "System is going down.")) < 0)
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering log_error("Failed to create /var/run/nologin: %s", strerror(-r));
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering if ((q = cg_kill_recursive_and_wait(SYSTEMD_CGROUP_CONTROLLER, "/user", true)) < 0)
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering log_error("Failed to kill sessions: %s", strerror(-q));
b2ca0d63277b10c9382d5bcfcdf320dbb712511bLennart Poettering if (r < 0 || q < 0)