In BleachBit, if I go to Edit > Preferences > General, I can check the "Start BleachBit with computer" checkbox, but this will only launch the BleachBit GUI every time I start my computer, without actually cleaning.
Instead, I would prefer to run the BleachBit CLI silently in the background and do the cleaning automatically using my presets, using the following command:
bleachbit -c --preset
I have tried setting up a cron
job with the @reboot
option. I also tried adding an entry in /etc/rc.local
but neither method worked.
Is there any simple way to do it?
Option 1: Editing the desktop configuration file manually
When the "Start BleachBit with computer" checkbox is activated, it creates a desktop configuration file called
bleachbit
in~/.config/autostart/
. This is very well explained in the posts Where are startup commands stored? and where is “startup applications” user config file for disabled and enabled applications?If you want to access the folder with
nautilus
make sure to enable View > Show Hidden Files, or use the Ctrl+H shortcut.Edit the file with your text editor of choice, for example using
gedit
. Open the terminal and run the command:Inside the file, locate the line
Exec=bleachbit
and replace it with:Save the changes. We're done.
Notice that after saving, the desktop configuration file is renamed automatically to
bleachbit.desktop
. This is default behavior.Option 2: Using the
gnome-session-properties
interfaceIf you prefer not to mess around with the desktop configuration file, you can use the
gnome-session-properties
interface, which will do that for you.First, open BleachBit and make sure that the "Start BleachBit with computer" checkbox is activated.
Next, open the terminal and run:
The
man
page reads:It will open the Startup Applications Preferences panel:
Select the "BleachBit" entry and click on "Edit".
Locate the "Command" field and replace the string with
bleachbit -c --preset
Click on "Save". We're done.
What line did you use to set up the cron job? I have a few set up to run on boot on my server and they work perfectly.
In my own crontab file (in
/var/spool/crontabs
) this is one of the working entriesI set this up through webmin but I'd guess it's the context that matters and not how it got there.
have you tried the command with the full bleachbit path?
I like to set up a dedicated script to run as a cron job or any other automated startup that isn't set up by the system itself, then I can test the script to make sure my command is correct and works, it makes it easier to troubleshoot issues I think.