The update of group by sql not work by crontab only

Hello,

I have a strange behavior when I modify a group by sql via crontab
if i do this in my terminal:
sudo sqlite3 /etc/pihole/gravity.db "update 'group' set 'enabled' = 0 where name = 'basmala_internet';" ; pihole -g

I can see that the flows are going well => it's good

however when i do this in the crontab
30 18 * * 1-5 sudo sqlite3 /etc/pihole/gravity.db "update 'group' set 'enabled' = 0 where name = 'basmala_internet';" ; pihole -g

flows are still blocked. => it's not good
what is even stranger is that visually on the group management GUI I see that it is disabled. => it's ok

that's why I added "pihole -g" because I said to myself that maybe it's not only the value in base to change but something else.

kind regards

Debug Token:

https://tricorder.pi-hole.net/rcsmhdy3h6

There is no need for pihole -g. You have to restart pihole's FTL to re-read the changed group list.

pihole restartdns reload-lists

ADD

I'm also not sure about the sudo within the cron file. I would place a cron for the root user instead

1 Like

thank you for your answer and your advice on sudo

the problem with crontab as root is that I will not be able to do the command pihole with the non-root user or else I will have to do something like su pi ...?

I need these two commands to be chained

i will try your command and update my post if it's ok

Sorry, I don't understand what you try to say. If you create a crontab for the root user there is no need for sudo within the commands. Both will be executed as root (who has sudo-power).

It should work like this

sqlite3 /etc/pihole/gravity.db "update 'group' set 'enabled' = 0 where name = 'basmala_internet';" ; pihole restartdns reload-list

Please try, bu I think it is better not to update but create a new reply.

Sorry,

No working

This is a debug file when the groupe is activate but whitout block.

https://tricorder.pi-hole.net/strxwwg2d3

Is there a specific reason you have the FTL branch on a dev version (and not the master)? For example, troubleshooting with a specfic build? FTL crash resolution?

*** [ DIAGNOSING ]: FTL version
[✓] FTL: vDev-5ad55e8 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)

Edit - in fact you have quite the mismatch, including a branch that we haven't released:

*** [ DIAGNOSING ]: Core version
[i] Core: v4.3.5 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)
[i] Branch: release/v5.0 (https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738#checkout)
[i] Commit: v4.3.5-465-g2de5362

*** [ DIAGNOSING ]: Web version
[i] Web: v5.0.2 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)
[i] Branch: master
[i] Commit: v5.0.2-0-gadd047a0

*** [ DIAGNOSING ]: FTL version
[✓] FTL: vDev-5ad55e8 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)
1 Like

I assume you mean this group? ID is 9:

id    name                                                enabled  date_added           date_modified        description                                       
   ----  --------------------------------------------------  -------  -------------------  -------------------  --------------------------------------------------
   9     basmala_internet                                    1        2020-06-07 14:34:57  2020-06-10 21:02:41  heure d'accès par jour

That group is active.

It is used with just one block

   36    3     (.)+                                                                                                  1        2020-05-20 18:59:37  2020-06-07 14:35:29  all

On one client:

   5     10.132.1.113                                                                                          2020-04-10 23:36:30  2020-06-07 15:28:02  Basmala iMac

Check the regex, it's not likely the thing you are trying to do.

   2020-06-10 15:00:26: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning:  SQLite3::query(): Unable to prepare statement: 5, database is locked in /var/www/html/admin/api_speedtest.php on line 115

Speedtest isn't our code.

Hello,

this expression is made to cut the internet at a specific time from where doing it via crontab

but internet are open on the device

I went to the developer branch to get v5 before the official release

I temporarily installed this hack to test my connection every hour because I regularly have internet disconnections

Our AdminLTE is at 5.0. We have no 5.0.2. Your code is from somebody other than Pi-hole.

  Pi-hole version is v5.0 (Latest: v5.0)
  AdminLTE version is v5.0 (Latest: v5.0)
  FTL version is v5.0 (Latest: v5.0)

What is your output of:

cd /var/www/html/admin && git show

yes this is a hack for include the reporte of speedtest (for check my connexion)

concerning the management of the branches how to return to the standard version? without reinstalling
it's true that with the release of V5 I no longer have a reason to be on the other branch

pihole checkout master

We need to get you on our stable code so we can provide support.

commit add047a03344a8ba58c2e63cd301aa39fb7c2c10 (HEAD -> master, tag: v5.0.2, origin/master, origin/HEAD)
Merge: 0468c6cf 460b09ef
Author: itsmesid <arevindh@gmail.com>
Date:   Thu Jun 4 07:10:13 2020 +0530

    Merge pull request #24 from arevindh/dev

    Support for official Speedtest-cli

no problem for downgrade ?

It isn't a downgrade. You are moving from the beta 5.0 to the master 5.0.

ok i do where ?
cd
pihole checkout master

in progress