]>
Commit | Line | Data |
---|---|---|
5eef597e MP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright 2014 David Herrmann <dh.herrmann@gmail.com> | |
7 | ||
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
22 | #include <errno.h> | |
23 | #include <stdlib.h> | |
24 | #include <string.h> | |
25 | #include "consoled.h" | |
26 | #include "log.h" | |
27 | #include "sd-daemon.h" | |
28 | #include "util.h" | |
29 | ||
30 | int main(int argc, char *argv[]) { | |
31 | _cleanup_(manager_freep) Manager *m = NULL; | |
32 | int r; | |
33 | ||
34 | log_set_target(LOG_TARGET_AUTO); | |
35 | log_parse_environment(); | |
36 | log_open(); | |
37 | ||
38 | umask(0022); | |
39 | ||
40 | if (argc != 1) { | |
41 | log_error("This program takes no arguments."); | |
42 | r = -EINVAL; | |
43 | goto out; | |
44 | } | |
45 | ||
46 | r = manager_new(&m); | |
47 | if (r < 0) { | |
f47781d8 | 48 | log_error_errno(r, "Could not create manager: %m"); |
5eef597e MP |
49 | goto out; |
50 | } | |
51 | ||
52 | sd_notify(false, | |
53 | "READY=1\n" | |
54 | "STATUS=Processing requests..."); | |
55 | ||
56 | r = manager_run(m); | |
57 | if (r < 0) { | |
f47781d8 | 58 | log_error_errno(r, "Cannot run manager: %m"); |
5eef597e MP |
59 | goto out; |
60 | } | |
61 | ||
62 | out: | |
63 | sd_notify(false, | |
64 | "STATUS=Shutting down..."); | |
65 | ||
66 | return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; | |
67 | } |