summaryrefslogtreecommitdiff
path: root/minix/commands/update/update.c
blob: 2c1d8783c1f73726b8fff76fa85b117ab6e108b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* update - do sync periodically		Author: Andy Tanenbaum */

#include <sys/types.h>
#include <signal.h>
#include <unistd.h>

int main(void);

int main()
{
  /* Release all (?) open file descriptors. */
  close(0);
  close(1);
  close(2);

  /* Release current directory to avoid locking current device. */
  chdir("/");

  /* Flush the cache every 30 seconds. */
  while (1) {
	sync();
	sleep(30);
  }
}