how to autmate periodic bleachcleaner?

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
boof
Posts: 555
Joined: Sat Aug 15, 2020 9:17 am
Been thanked: 8 times

how to autmate periodic bleachcleaner?

Post 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.

williams2
Posts: 1059
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 302 times

Re: how to autmate periodic bleachcleaner?

Post 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 ?

boof
Posts: 555
Joined: Sat Aug 15, 2020 9:17 am
Been thanked: 8 times

Re: how to autmate periodic bleachcleaner?

Post 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

williams2
Posts: 1059
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 302 times

Re: how to autmate periodic bleachcleaner?

Post 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
boof
Posts: 555
Joined: Sat Aug 15, 2020 9:17 am
Been thanked: 8 times

Re: how to autmate periodic bleachcleaner?

Post 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.

williams2
Posts: 1059
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 302 times

Re: how to autmate periodic bleachcleaner?

Post 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.

Post Reply

Return to “Users”