blob: ac43b1b1acc64ae162a2ae27546745e2a88a26bc (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/bin/sh
. ${PM_FUNCTIONS}
JOURNAL_COMMIT_TIME_AC=${JOURNAL_COMMIT_TIME_AC:-0}
JOURNAL_COMMIT_TIME_BAT=${JOURNAL_COMMIT_TIME_BAT:-600}
help() {
cat <<EOF
Journal commit time parameters:
JOURNAL_COMMIT_TIME_AC = number of seconds between journal commits on AC.
Defaults to 0, which sets the filesystem back to its default value.
JOURNAL_COMMIT_TIME_BAT = number of seconds between journal commits on battery.
Defaults to 600 (10 minutes).
We currently only handle EXT3 filesystems
EOF
}
# 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 $JOURNAL_COMMIT_TIME_BAT ;;
false) handle_filesystems $JOURNAL_COMMIT_TIME_AC ;;
help) help;;
*) exit $NA ;;
esac
exit 0
|