Page 1 of 1

how to autmate periodic bleachcleaner?

Posted: Fri Apr 30, 2021 9:42 am
by boof

it des what i want, just need to make it automatic at say, 8pm and midnight and 7am. firefox can be disabled around those times., and restarted after the cleans. hope it preserves my choices. thx.


Re: how to autmate periodic bleachcleaner?

Posted: Fri Apr 30, 2021 7:12 pm
by williams2

Do you mean bleachbit?
https://docs.bleachbit.org/
https://docs.bleachbit.org/doc/command- ... rface.html

You could start the browser from a script that always runs bleachbit then the browser. Something like:

Code: Select all

bleachbit --clean firefox.vacuum
start-firefox

Or you can use crond. You can enable crond and configure it manually,
or you can use the GUI configuration program in Puppy's menu,
or type pschedule in a text terminal.

I'm not sure, I think you can use the configuration that you set up in the gui,
like this bleachbit --preset or maybe bleachbit --preset --clean ?


Re: how to autmate periodic bleachcleaner?

Posted: Fri Apr 30, 2021 8:58 pm
by boof

thx, got that.
how to disable firefox pror so ican run bleachbit pls?

like this?

#!/bin/sh
while true
do
while firefox
do
kill 745
bleachbit --clean firefox.vacuum
end
firefox
sleep 6h
end


Re: how to autmate periodic bleachcleaner?

Posted: Fri Apr 30, 2021 10:04 pm
by williams2

If you want to use a script, maybe:

Code: Select all

#!/bin/sh
while true
do
killall -q firefox
bleachbit --clean firefox.vacuum
start-firefox & disown
sleep 8h
done

This will run bleachbit 3 times a day, then start firefox from a script named "start-firefox"
I assume you know how to start Firefox so that it does what you want automatically.

The script will start immediately and run bleachbit, then run bleachbit again 8 hours after it starts.
For example, if you start the script at 3 am then
bleachbit will run at 03:00 and 11:00 and 19:00 and 03:00 etc etc

EDIT: It takes time to use bleachbit so that time will be added to the 8 hour sleep.
You could work around that, but crond would probably work better.

EDIT: Also,, if you exit Firefox, the script will start it again, after the sleep, unless you kill the script too.

crond would probably be more configurable. It can be configured to run at specific times.
For example, 0 7,20,24 * * * /root/start-firefox would run at 7am, 8pm, and midnight
and the start-firefox script might look like:

Code: Select all

#!/bin/sh
killall -q firefox
bleachbit --clean firefox.vacuum
exec firefox

Re: how to autmate periodic bleachcleaner?

Posted: Wed May 05, 2021 5:44 pm
by boof

#!/bin/sh
while true
do
firefox
sleep 8h
killall -q firefox
sleep 10s
bleachbit --clean firefox.vacuum
sleep 30
done

is my final script. works. allows runtime for operation, using preconfig actions.


Re: how to autmate periodic bleachcleaner?

Posted: Thu May 06, 2021 6:41 pm
by williams2

You really need firefox to be firefox &
You need the amperand & character so that firefox will run in the background.

Your script will run firefox, it will wait until firefox exits before it will execute the next line sleep 8h

so your script needs to be, at least:

Code: Select all

#!/bin/sh
while true
do
firefox &
sleep 8h
killall -q firefox
sleep 10s
bleachbit --clean firefox.vacuum
sleep 30
done

I think the last script I wrote should work:

Code: Select all

#!/bin/sh
while true
do
( killall -q firefox
bleachbit --clean firefox.vacuum
sleep 30
firefox ) & disown
sleep 8h
done

The code in parentheses should run in the background so the next command, the sleep 8h instruction, should execute immediately.
I don't think it should need a sleep 30 instruction after bleachbit
A sleep instruction there would not hurt anything.

The disown instruction is just to direct messages away from the execution of the script, so it's not totally necessary.
The ampersand & is very necessary.

Crond would probably be better than a script for what you want to do. see my last post.