I'm trying to do something and following it's an example with my /home/antoine/.cache folder :
In my fstab, I want to create /media/ramdisk as a tmpfs
Code: Select all
tmpfs /media/ramdisk/ tmpfs "options" 0 0
1) create /media/ramdisk/.cache folder in it and a symlink to /home/antoine/.cache when I boot
2) copy the .cache folder on the ramdisk to my /home/antoine when I shutdown my computer
Then I've edited the /etc/rc.local file
Code: Select all
#!/bin/sh -e
#
# rc.local
#
/bin/mkdir /media/ramdisk/.cache
/bin/mv /home/antoine/.cache /media/.cache
/bin/ln -s /media/.cache /home/antoine/.cache
exit 0
- /etc/rc.local.shutdown
Code: Select all
#!/bin/sh -e
#
# rc.local.shutdown
#
rm /home/antoine/.cache
mv /media/ramdisk/.cache /home/antoine
exit 0
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $all
# Required-Stop:
# Default-Start: 0
# Default-Stop:
# Short-Description: Run /etc/rc.local.shutdown if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local.shutdown ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local shutdown scripts (/etc/rc.local.shutdown)"
/etc/rc.local.shutdown
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
And after that, I need to "update-rc.d", that's right ?