Running CLI at boot start


I have tried "/usr/bin/bleachbit --delete --preset" and "bleachbit --delete --preset" in rc.local, but this produces nothing. My aim is to automatically perform all cleaning without the need for intervention each time the machine is booted up. Maybe it can't be done. Any thoughts on the matter?

I think rc.local is executed in the root user's context, so the presets will differ from your individual user account.

Assuming you want to use the settings stored in your individual account and to clean your individual account, try this and assuming your username is JSladek (not tested)
sudo -u JSladek bleachbit --delete --preset

This changes the user context to JSladek.

Andrew, lead developer

Since there was nothing I could do to make it work, I decided to try to set the root portion of the "cleanup" as a cron job. But I seem to be getting nowhere there as well. I went to root and set up a root crontab with "/usr/bin/bleachbit --preview apt.autoclean apt.autoremove apt.clean system.rotated_logs >> /home/jim/Desktop/bleachbit.log" as the operative command. As a "preview" action, it worked fine, but as a "delete" action, it does nothing except, of course, produce the log file with no deletions in it and no deletions occur in the root folders.

This method would do just fine running a cronjob say once a week or so for these files and the /home/jim files can be handles with bleachbit with a preset running as a KDE autostart action.

Make sure to capture stderr in the redirection like this
/usr/bin/bleachbit --delete apt.autoclean apt.autoremove apt.clean system.rotated_logs >> /home/jim/Desktop/bleachbit.log 2>&1

The extra information in the log may explain why it is failing.

Andrew, lead developer

/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/ GtkWarning: could not open display
warnings.warn(str(e), _gtk.Warning)
Usage: bleachbit [options] cleaner.option1 cleaner.option2

bleachbit: error: no such option: --delete
info: starting BleachBit version 1.2

This looks like it's trying to open in GUI, but it's supposed to be CLI. I wonder if the "no such option" is causing that. But --delete is supposed to be an option. ?????

I used the --clean option instead of the --delete. So now it works under cron .... it still has the GTK error, but at least it now runs and actually deletes the intended files. The delete option is not listed in the help file ... it is version 2-1 and maybe there's been a change.

So, I have to consider this one resolved from my standpoint - it works.

The original issue of activating bleachbit from rc.local remains unresolved - no matter how I write the commandline, it still doesn't work. But functionally, the cronjob direction is, as I found out, a much better way of doing what I wanted done. - apt.clean and system.rotated_logs are quite adequately done once a week or once a month. The remainder of my "needs" are easily handled with a running of bleachbit preset with KDE startup.