Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] How can I run bleachbit by crontab 10 minutes after

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
GabrieleMax
Posts: 126
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy
Has thanked: 4 times
Been thanked: 1 time
Contact:

[SOLVED] How can I run bleachbit by crontab 10 minutes after

#1 Post by GabrieleMax »

Hi everybody! :)

Usually I use bleachbit scheduled on servers at night by crontab job, I use it also on my laptop when I need it but... I should use it also on a "end user" pc/laptop but without user works!

Maybe I could load bleachbit on startup but yuo know startup is a heavy time for a pc and I would run bleachbit after 10-15 minutes or a good idea it could start at screensaver time!

Is it possible to do it?

Regards.
GabrieleMax
Last edited by GabrieleMax on 2017-03-29 20:01, edited 1 time in total.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: How can I run bleachbit by crontab 10 minutes after star

#2 Post by Segfault »

Running bleachbit on servers ... what's the idea?

GabrieleMax
Posts: 126
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How can I run bleachbit by crontab 10 minutes after star

#3 Post by GabrieleMax »

Segfault wrote:Running bleachbit on servers ... what's the idea?
Bleachbit works well on my servers, I need to use it on user's pc and I'd like to run it in silent mode after 10-15 or when there's screensaver mode!

Regards.
GabrieleMax

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: How can I run bleachbit by crontab 10 minutes after star

#4 Post by Segfault »

You mean you feel the need to run bleachbit on Linux servers?! Those servers are misconfigured somehow or what?

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: How can I run bleachbit by crontab 10 minutes after star

#5 Post by dasein »

I'm skeptical of running bleachbit at all, but if you insist on doing it...

A(ny) time-based scheme is going to be inherently suboptimal, since you have no idea what this hypothetical user might be doing 10 (or 5, or 33) minutes after startup.

Seems to me that the vastly more sensible approach would be to invoke via script at user login and nice it to the point that it runs only when the CPU has nothing else to do. (See man nice for details.)

GabrieleMax
Posts: 126
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How can I run bleachbit by crontab 10 minutes after star

#6 Post by GabrieleMax »

dasein wrote:I'm skeptical of running bleachbit at all, but if you insist on doing it...
Please can you explain me why you got dubts about it? I use some scripts and they works well...
dasein wrote: A(ny) time-based scheme is going to be inherently suboptimal, since you have no idea what this hypothetical user might be doing 10 (or 5, or 33) minutes after startup.
Yes... it's really true...
dasein wrote: Seems to me that the vastly more sensible approach would be to invoke via script at user login and nice it to the point that it runs only when the CPU has nothing else to do. (See man nice for details.)
I didn't know nice, I'm reading about it and it should be the best way to solve my "problem"! :)

Many thanks!
Regards.
GabrieleMax

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: How can I run bleachbit by crontab 10 minutes after star

#7 Post by dasein »

GabrieleMax wrote:
dasein wrote:I'm skeptical of running bleachbit at all, but if you insist on doing it...
Please can you explain me why you got dubts about it? I use some scripts and they works well...
Unless the content in question is explicitly temporary (the contents of /tmp, for instance), I think that automating anything destructive is shortsighted. And given how inexpensive disk space is, there's really no benefit to saving a fraction of a penny's worth of disk space.
GabrieleMax wrote:I didn't know nice, I'm reading about it and it should be the best way to solve my "problem"! :)
Then please take a moment to mark your thread as [SOLVED]. (Edit the subject line of your initial post)

millpond
Posts: 698
Joined: 2014-06-25 04:56

Re: How can I run bleachbit by crontab 10 minutes after star

#8 Post by millpond »

The OP should really reconsider the wisdom of running a system cleaning process during normal operations. Things like logs and temp files and what-not are *used* by running processes, and deleting them is something of a recipe for disaster.

Ideally this operation should be done at startup, shutdown, or during maintenance hours on a server.
There is nothing wrong with using cron for maintenance activities, and bleachbit is certainly a useful operation to include in a more comprehensive script.

One possible other scenario is a server that deliberately desires to frequently wipe logs. Particularly as turning off logging is often difficult. One option for this is to mount the /var/logs directory to ram, and wipe it periodically.

There is a utility called ramlog for this purpose, but its written as a PPA and the script needs to be fixed for use with Debian. Its a shell script, so thats no biggie. Here its configured to a minimum size, and effectively wiped at shutdown.
https://www.linux.com/news/improve-syst ... -files-ram
(Its sysvinit, which I use here. No clue as to how it works with systemd).

A newer variant would be:
http://www.linux-magazine.com/Online/Bl ... -LogRunner
The archive directory -gzpath, can be set to /dev/null. Its a python script.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: How can I run bleachbit by crontab 10 minutes after star

#9 Post by bw123 »

I'm with segfault, why? What does bleachblt have a need to do after 10 min ?
resigned by AI ChatGPT

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: How can I run bleachbit by crontab 10 minutes after star

#10 Post by GarryRicketson »

There is a lot that is not clear on this, so I don't see any way any one can say exactly how, or write some script for the OP, which is what it sound like they want.
It does not matter , why , but the important part, that does matter is: What does the OP want "bleach bit" to do, at the time crontab is set to run.
So the OP needs to look at the manual for bleach bit, and see what commands
are available, decide which ones to run,..then also read the manual on crontab,

Code: Select all

man bleachbit
=======

Code: Select all

man crontab
======
Basically it is simple, but it might be some what more complex depending
on what bleachbit commands need to be run.
A simple example:
From: http://www.bleachbit.org/documentation/command-line
cron example (Linux)

To vacuum Firefox each night at 03:00, run:

Code: Select all

crontab -e
and add this line:

Code: Select all

0 3 * * * bleachbit --clean firefox.vacuum 
Note:
Linux

Running bleachbit (which is in the path) with arguments runs BleachBit in command line mode. Without arguments, BleachBit runs in graphical mode. The clipboard can only be cleaned under an X session (which is generally not available over SSH or in cron).
Something else that is confusing, is it the servers, or the laptop the OP wants
to do this,..Normally a server is running 24hours daily, and is not shutdown and
rebooted every day,..doing this at "startup", would not be very often,..but to use
crontab, you would have to know what time the "start up" will occur, and the
set crontab accordingly,...IE: if "startup" is at 8am, you would want to set crontab
so it runs the command or commands at 8:10 am,...
GabrieleMax »---- a good idea it could start at screensaver time!
I am inclined to think this means the OP is not talking about doing this on a server, but on their laptop, servers do not normally use any "screensavers"
???
In any event, the OP could do some searches, and maybe find some examples that will help,
how to run bleachbit by crontab
or use :

Code: Select all

 How can I run bleachbit by crontab 10 minutes after startup? 
as keywords.
by millpond »--and bleachbit is certainly a useful operation to include in a more comprehensive script.
I don't think I would use bleachbit , myself for this, but there is nothing wrong with that, but even if it was not going to be done with bleachbit, we would need a more comprehensive description of what commands the OP wants to run using crontab, so they could be included in a script.
I do not understand the "logic" or lack of, in the OP's approach,..sorry.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: How can I run bleachbit by crontab 10 minutes after star

#11 Post by Segfault »

What exactly is what bleachbit can do and a properly configured server cannot? There are millions of Linux servers running and they can keep their nose clean without bleaching.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: How can I run bleachbit by crontab 10 minutes after star

#12 Post by debiman »

i know this is just a rant, but imo bleachbit has been designed by and is geared towards linux (cough... ubuntu) users that cannot let go of the old windows user paradigm that the operating system is working against them, and therefor they constantly have to work against the operating system.

GabrieleMax
Posts: 126
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How can I run bleachbit by crontab 10 minutes after star

#13 Post by GabrieleMax »

dasein wrote: Unless the content in question is explicitly temporary (the contents of /tmp, for instance), I think that automating anything destructive is shortsighted. And given how inexpensive disk space is, there's really no benefit to saving a fraction of a penny's worth of disk space.
I understood what you said but sometime end user cleans nothing on his o.s. and I think to clear old packets, cache, etc. could be a good idea... I got in my mind my first pc a IBM PS/1 with just 40MB of hard drive with everyday problems of free space! :)
dasein wrote: Then please take a moment to mark your thread as [SOLVED]. (Edit the subject line of your initial post)
I did it! :)

GabrieleMax
Posts: 126
Joined: 2016-09-07 20:24
Location: Senigallia (AN) - Italy
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How can I run bleachbit by crontab 10 minutes after star

#14 Post by GabrieleMax »

millpond wrote:The OP should really reconsider the wisdom of running a system cleaning process during normal operations. Things like logs and temp files and what-not are *used* by running processes, and deleting them is something of a recipe for disaster.
Ok but if you clean cache or old packets you can save a lot of space and it's not dangerous on a end user pc, I don't erase logs!
millpond wrote: Ideally this operation should be done at startup, shutdown, or during maintenance hours on a server.
When I run bleachbit on a server I schedule scripts at late night when there isnt't activity.
millpond wrote: There is nothing wrong with using cron for maintenance activities, and bleachbit is certainly a useful operation to include in a more comprehensive script.
Finally someone who don't hate bleachbit! :) Can I ask you something about "more comprehensive script"? I'd like to know your idea about how to clean a system...
millpond wrote: One possible other scenario is a server that deliberately desires to frequently wipe logs. Particularly as turning off logging is often difficult. One option for this is to mount the /var/logs directory to ram, and wipe it periodically.
I don't know this method... but I'll "study" it! :)
millpond wrote: There is a utility called ramlog for this purpose, but its written as a PPA and the script needs to be fixed for use with Debian. Its a shell script, so thats no biggie. Here its configured to a minimum size, and effectively wiped at shutdown.
https://www.linux.com/news/improve-syst ... -files-ram
(Its sysvinit, which I use here. No clue as to how it works with systemd).
I'll try it! :)
millpond wrote: A newer variant would be:
http://www.linux-magazine.com/Online/Bl ... -LogRunner
The archive directory -gzpath, can be set to /dev/null. Its a python script.
Many thanks for everything! :)

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

Re: How can I run bleachbit by crontab 10 minutes after star

#15 Post by sunrat »

millpond wrote:One possible other scenario is a server that deliberately desires to frequently wipe logs.
Isn't that what logrotate is for?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Post Reply