truncate $PERSISTENCE_LOG
timer_end "update-at-save.log"
else
log "not saving, not loaded" true
fi
}
function link() {
log "link"
if [ -d "$RAMDISK_CONTENT_LINK" ]; then
cd $RAMDISK_CONTENT_LINK
shopt -s dotglob
for d in */ ; do
if [ "$d" = "*/" ]; then
continue
fi
GENERATED_LINK="${ROOT}/${d}"
DIR=${d%/*}
log "link $RAMDISK_CONTENT_LINK/$DIR to $ROOT/$DIR"
# delete actual directory, no slash! otherwise it shows not empty
if [ -d "${ROOT}/${DIR}" ]; then
unlink "${ROOT}/${DIR}" || true
fi
ln -s "${RAMDISK_CONTENT_LINK}/${DIR}" $ROOT
done
fi
log "link done"
}
if [ "$COMMAND" == "load" ]
then
load
exit
fi
if [ "$COMMAND" == "save" ]
then
save
exit
fi
if [ "$COMMAND" == "link" ]
then
link
exit
fi
if [ "$COMMAND" == "start" ]
then
start
exit
fi
if [ "$COMMAND" == "stop" ]
then
stop
exit
fi
if [ "$COMMAND" == "install" ]
then
install
exit
fi
if [ "$COMMAND" == "watch" ]
then
WATCH1="df -h | grep -e "
WATCH2=$RAMDISK
WATCH3=" -e Size"
watch $WATCH1$WATCH2$WATCH3
exit
fi
cat <<EOT >&1
Eg:
sudo $ME install
sudo $ME start
$ME watch
$ME save
$ME load
Unknown type: {$TYPE} command: {$COMMAND}
Requires 2 parameters:
type: anything (like boot, timer, terminal), default is "terminal"
command: install, start, stop, load, save, watch
EOT