summaryrefslogtreecommitdiff
path: root/pm/power.d/journal-commit
blob: be68fedc5941c872600b769d8d275e81b4b12ed9 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

. ${PM_FUNCTIONS}

# actually remount the file system
remount_fs()
{
	# $1 = filesystem to remount
	# $2 = mount option to change
	mount -o remount,$2 $1
}

# invoked on an ext3 file system
handle_ext3()
{
	# $1 = filesystem to remount
	# $2 = commit time
	remount_fs $1 "commit=${2}"
}

handle_filesystems()
{
	# $1 = new journal commit time in seconds
	while read DEV MOUNT FSTYPE REST; 
	do
		command_exists "handle_${FSTYPE}" || continue
		"handle_${FSTYPE}" $MOUNT $1
	done < /proc/mounts
}

case $1 in
	true) handle_filesystems 600 ;;
	false) handle_filesystems 5 ;;
	*) exit $NA ;;
esac

exit 0