blob: 263a82cca20a94e3db28cb28e4adea34e98db4df [file] [log] [blame]
#!/bin/sh
helper() {
[ "$1" != "$2" ]
}
expands() {
# Determine if $1 gets expanded. If it does then it's probably a glob pattern
# that matches a file. For example, helper "/etc/hostna*" /etc/hostna* will
# turn into "/etc/hostna*" /etc/hostname if /etc/hostname exists.
helper "$1" $1
}
case "$1" in
start)
if [ ! -z "$(lsubi)" ] && \
( expands "/sys/kernel/debug/ubifs/*/readonly" || \
expands "/sys/kernel/debug/ubifs/*/ro_error" ) ; then
nice babysit 60 ubifsmonitor 2>&1 | logos ubifsmonitor &
fi
;;
stop)
pkillwait -x ubifsmonitor
;;
restart|reload)
$0 stop; $0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac