Commit | Line | Data |
---|---|---|
2f097a05 KB |
1 | /*- |
2 | * Copyright (c) 1987, 1990 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
9f49a1fa KB |
6 | */ |
7 | ||
8 | #ifndef lint | |
2f097a05 KB |
9 | char copyright[] = |
10 | "@(#) Copyright (c) 1987, 1990 The Regents of the University of California.\n\ | |
11 | All rights reserved.\n"; | |
12 | #endif /* not lint */ | |
9f49a1fa | 13 | |
2f097a05 | 14 | #ifndef lint |
576ae68b | 15 | static char sccsid[] = "@(#)update.c 5.1 (Berkeley) %G%"; |
2f097a05 | 16 | #endif /* not lint */ |
a675940b | 17 | |
9f49a1fa | 18 | #include <sys/time.h> |
2f097a05 | 19 | #include <signal.h> |
2f097a05 KB |
20 | #include <stdlib.h> |
21 | #include <stdio.h> | |
22 | #include <unistd.h> | |
a675940b BJ |
23 | |
24 | main() | |
25 | { | |
aa64fd71 | 26 | struct itimerval value; |
2f097a05 | 27 | void mysync(); |
a675940b | 28 | |
aa64fd71 | 29 | daemon(0, 0); |
2f097a05 | 30 | |
2f097a05 KB |
31 | (void)signal(SIGALRM, mysync); |
32 | ||
9f49a1fa KB |
33 | value.it_interval.tv_sec = 30; |
34 | value.it_interval.tv_usec = 0; | |
35 | value.it_value = value.it_interval; | |
2f097a05 | 36 | if (setitimer(ITIMER_REAL, &value, NULL)) { |
9f49a1fa KB |
37 | perror("update: setitimer"); |
38 | exit(1); | |
39 | } | |
40 | for (;;) | |
576ae68b KB |
41 | sigpause(sigblock(0L)); |
42 | /* NOTREACHED */ | |
a675940b | 43 | } |
2f097a05 | 44 | |
2f097a05 | 45 | void |
576ae68b | 46 | mysync() |
2f097a05 KB |
47 | { |
48 | (void)sync(); | |
49 | } |