Here is my rc.local content.:
Code: Select all
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo noop > /sys/block/sda/queue/scheduler
echo 6 > /sys/class/backlight/acpi_video0/brightness
/sbin/fstrim /
echo fstrim root >> /home/xxx/bootcheck.txt
/sbin/fstrim /media/xxx/Data/
echo fstrim Data >> /home/xxx/bootcheck.txt
/usr/bin/trash-empty 7
# requires trash-cli installed
echo trash >> /home/xxx/bootcheck.txt
echo 2048 > /sys/class/rtc/rtc0/max_user_freq
echo all working > /home/xxx/bootcheck.txt
exit 0
BUT the commands don't seem to actually be doing their thing! Well the screen brightness is. I want a way to empty the Rubbish Bin on boot, so had searched for a CLI method of doing so for all partitions. Trash-cli installed and then running trash-empty seemed to be an often recommended way. The number 7 means it will delete anything over 7 days old. (Yes I could do a cron job but I also likely will change it to empty the whole Rubbish Bin once I'm a little more settled and confident.) Personally I would prefer do it on boot than periodically...
Also didn't think fstrim was working, as I ran it on the Data partition after booting and it trimmed a lot. Just realised that I tested the trash really hadn't deleted first though, so that would have added data to be trimmed by that function. Need to test that again...
Any idea why things may not be working as I would expect??
EDIT: I have moved the trash-empty line to above the fstrim lines as it makes sense, otherwise you wont trim the space made by clearing the trash.
I also confirmed that manually running "fstrim -v /" directly after booting and doing nothing but opening a terminal to type and it is still finding data to trim. Thus surely that implies it's not running correctly in the rc.local script...