Line | |
---|
1 | /* update - do sync periodically Author: Andy Tanenbaum */
|
---|
2 |
|
---|
3 | #include <sys/types.h>
|
---|
4 | #include <signal.h>
|
---|
5 | #include <unistd.h>
|
---|
6 |
|
---|
7 | _PROTOTYPE(int main, (void));
|
---|
8 |
|
---|
9 | int main()
|
---|
10 | {
|
---|
11 | /* Release all (?) open file descriptors. */
|
---|
12 | close(0);
|
---|
13 | close(1);
|
---|
14 | close(2);
|
---|
15 |
|
---|
16 | /* Release current directory to avoid locking current device. */
|
---|
17 | chdir("/");
|
---|
18 |
|
---|
19 | /* Flush the cache every 30 seconds. */
|
---|
20 | while (1) {
|
---|
21 | sync();
|
---|
22 | sleep(30);
|
---|
23 | }
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.