]>
Commit | Line | Data |
---|---|---|
e96d6be7 LP |
1 | /*** |
2 | This file is part of systemd. | |
3 | ||
4 | Copyright 2012 Lennart Poettering | |
5 | ||
6 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
7 | under the terms of the GNU Lesser General Public License as published by |
8 | the Free Software Foundation; either version 2.1 of the License, or | |
e96d6be7 LP |
9 | (at your option) any later version. |
10 | ||
11 | systemd is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 14 | Lesser General Public License for more details. |
e96d6be7 | 15 | |
5430f7f2 | 16 | You should have received a copy of the GNU Lesser General Public License |
e96d6be7 LP |
17 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
18 | ***/ | |
19 | ||
20 | #include <unistd.h> | |
e96d6be7 | 21 | |
e96d6be7 | 22 | #include "log.h" |
cf0fbc49 | 23 | #include "watchdog.h" |
e96d6be7 LP |
24 | |
25 | int main(int argc, char *argv[]) { | |
26 | usec_t t = 10 * USEC_PER_SEC; | |
27 | unsigned i; | |
28 | int r; | |
29 | ||
30 | log_set_max_level(LOG_DEBUG); | |
31 | log_parse_environment(); | |
32 | ||
33 | r = watchdog_set_timeout(&t); | |
34 | if (r < 0) | |
da927ba9 | 35 | log_warning_errno(r, "Failed to open watchdog: %m"); |
e96d6be7 LP |
36 | |
37 | for (i = 0; i < 5; i++) { | |
38 | log_info("Pinging..."); | |
39 | r = watchdog_ping(); | |
40 | if (r < 0) | |
da927ba9 | 41 | log_warning_errno(r, "Failed to ping watchdog: %m"); |
e96d6be7 LP |
42 | |
43 | usleep(t/2); | |
44 | } | |
45 | ||
46 | watchdog_close(true); | |
47 | return 0; | |
48 | } |