Okay, to copy on the files on boot. You could set cron to auto copy the files on boot.
Open a terminal and type the following
Code:
export EDITOR=nano
crontab -e
Now add this line
Code:
@reboot cp -rpf /home/user/temp /dev/shm
(Correct me if I'm wrong but I think user crontabs work even when the user is not logged in)
(@reboot works on boot as well, not just reboots)
Now press Ctrl+O -> Enter -> Ctrl+X
For the shutdown, this is a bit tricky and risky.
As a AI known to some people would say:
"Federal regulations require me to inform you that this next step is... looking pretty dangerous"
So. This step is dangerous, might eat your cat, break your flowerpot, take all your money, point fingers at you and laugh.
To minimize the risk we will edit a system file that is responsible for unattended upgrades.
Type this
Code:
gksudo gedit /etc/rc0.d/S10unattended-upgrades
Or if you really liked nano
Code:
sudo nano /etc/rc0.d/S10unattended-upgrades
Add this line
Code:
cp -rpf /dev/shm/temp /home/user/
right after the comments end (The ones with #) and the PATH, NAME and DESC lines. So it should look like this (Might be different since I'm on 11.04)
PHP Code:
#! /bin/sh
#
### BEGIN INIT INFO
# Required-Start:
# Required-Stop:
# Provides: unattended-upgrade-shutdown-check
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Check if unattended upgrades are being applied
# Description: Check if unattended upgrades are being applied
# and wait for them to finish
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=unattended-upgrades
DESC=unattended-upgrades
cp -rpf /dev/shm/temp /home/user/
set -e
case "$1" in
start|stop)
echo -n "Checking for running $DESC: "
python /usr/share/unattended-upgrades/unattended-upgrade-shutdown
;;
restart|force-reload)
# nothing
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Don't edit anything else. Save the file and now manually copy the temp folder to /dev/shm (Not contents, the folder)
Bookmarks