Command works in termux but not in macrodroid shell

I went into termux and installed sqlite and verified sqlite is working once I installed the package.

So long as I'm in termux it works great.

If I use the same sqlite3 command in macrodroid shell I get : not found or inaccessible

Any other approach to use database in macrodroid is welcome.
 

MacroDroidDev

Administrator
Staff member
I don't know a great deal about termux, but does it possibly install some additional binaries that aren't installed by default on the Android shell?
 
I did do some installs when I was in terminux to get it working.

I had thought it was installing them on my phone in general but I'm starting to think that the install only works for terminux.

When I first called sqlite3 it reported sqlite not installed and recommended I installed the package. Once I did it worked like a charm!

So based on your comment and my experience I'm thinking the install only works within terminux shell and not in a general way on my phone linux background.

I tried putting the sqlite3 file on my SD card and calling it from macrodroid. Even though the file says rwxrwx macrodroid wouldn't launch it.

I've put soooo many hours over the last 3 years trying to get this to work :(

Meanwhile I found this and wonder if it might be helpful to my cause:

.

Tasker sqlite plugin seems to no longer work. Tasker now has on board sql calls that work, but there's no way to pass the query or the results between macrodroid and Tasker.

I also tried memento db, which is totally useless because you can't query the db, only do puts. What use is saving data if you can't retrieve it!?

I'm totally willing to pay for feature development for anyone to get sql working through macrodroid.

Any help is much appreciated.
 
I've even been so desperate for it to work that last year I created my own xml file parser workaround using shell to save and retrieve my records as xml entries in my custom files but it's certainly not as good as having sql actually work.
 
Is there some way to specify to macrodroid to use termux as the program.to use for all shell commands?

I went to app permissions under macrodroid and allowed the permission for termux but sqlite3 still will not launch from within macrodroid and I'm not sure how to test if MD is using termux for the shell activity or not.
 
I logged in to termux and typed echo $0

And rhe system showed me rhe path for termux binaries.

Then I went to MD shell and did the same echo $0 and it showed me the basic path for bin/sh not the same one termux is using

How can I force MD to use termux instead?
 

greenteafox

New member
I did do some installs when I was in terminux to get it working.

I had thought it was installing them on my phone in general but I'm starting to think that the install only works for terminux.

When I first called sqlite3 it reported sqlite not installed and recommended I installed the package. Once I did it worked like a charm!

So based on your comment and my experience I'm thinking the install only works within terminux shell and not in a general way on my phone linux background.

I tried putting the sqlite3 file on my SD card and calling it from macrodroid. Even though the file says rwxrwx macrodroid wouldn't launch it.

I've put soooo many hours over the last 3 years trying to get this to work :(

Meanwhile I found this and wonder if it might be helpful to my cause:

.

Tasker sqlite plugin seems to no longer work. Tasker now has on board sql calls that work, but there's no way to pass the query or the results between macrodroid and Tasker.

I also tried memento db, which is totally useless because you can't query the db, only do puts. What use is saving data if you can't retrieve it!?

I'm totally willing to pay for feature development for anyone to get sql working through macrodroid.

Any help is much appreciated.
Hi! I'm currently trying to make MacroDroid work with SQLite and I've been successful so far. I just came into the forum looking it up and see if I could find ideas/inspirations and stumbled at your post. It's a very old thread, but since you said you've been looking into this for 3 years, I guess you might still be interested... 😅
If that's the case, hit me up. I can share with you the current state of my action blocks.
I managed to get it working by using Termux:Tasker plugin and MD Helper. And you're right, when you install something on Termux it's kinda contained within it, so the only way I could find to access the sqlite3 bin was through the plugin.
 
Hi! I'm currently trying to make MacroDroid work with SQLite and I've been successful so far. I just came into the forum looking it up and see if I could find ideas/inspirations and stumbled at your post. It's a very old thread, but since you said you've been looking into this for 3 years, I guess you might still be interested... 😅
If that's the case, hit me up. I can share with you the current state of my action blocks.
I managed to get it working by using Termux:Tasker plugin and MD Helper. And you're right, when you install something on Termux it's kinda contained within it, so the only way I could find to access the sqlite3 bin was through the plugin.
Greenteafox!!
Im still very interested!!

Any additional or more detailed steps you can post would be VERY MUCH APPRECIATED!!
 

greenteafox

New member
Great to hear! I'll try to explain everything I did and had to setup.

First of all, you definitely need the Termux shell. Unless there's a way to "smuggle" the sqlite3 executable inside the Android system (in a way that /system/usr/bin/sh sees it) using the "Shell Script" won't work, unfortunately. I still didn't give up that yet and still didn't mess with ADB hacking, so this might be possible though...
You also need to install the sqlite3 package using the pkg install sqlite command on Termux.
Besides that, you need that Termux - Tasker Plugin so you can communicate with Termux from MacroDroid. The one from Play Store was deprecated, so you need to get that from F-Droid.
You also gonna need the MD Helper app because you'll need the file permission to interact with the database file.

Having all that in hands, all you need now is to make the appropriate "calls" to the Termux plugin. I've attached the Action Blocks I created for that purpose. One of those is just to make it easier to handle errors and debug the commands, and the other is really executing the SQL statements. You may notice some disabled notifications, I use that just for debugging sometimes.

Hope that helps anyone out there.
 

Attachments

  • run_termux_handling_errors.ablock
    13.1 KB · Views: 8
  • sql - execute_stmt.ablock
    18.8 KB · Views: 9
Last edited:

Endercraft

Moderator (& bug finder :D)
EDIT:
I guess I can't directly attach Action Blocks here, so I dumped them on pastebin. Anyone interested, just have to download this and use the proper extension (.ablock).
A quick workaround for this is renaming .ablock to .macro
But I'm still not sure why these actions blocks extensions can't be uploaded.
 
Great to hear! I'll try to explain everything I did and had to setup.

First of all, you definitely need the Termux shell. Unless there's a way to "smuggle" the sqlite3 executable inside the Android system (in a way that /system/usr/bin/sh sees it) using the "Shell Script" won't work, unfortunately. I still didn't give up that yet and still didn't mess with ADB hacking, so this might be possible though...
You also need to install the sqlite3 package using the pkg install sqlite command on Termux.
Besides that, you need that Termux - Tasker Plugin so you can communicate with Termux from MacroDroid. The one from Play Store was deprecated, so you need to get that from F-Droid.
You also gonna need the MD Helper app because you'll need the file permission to interact with the database file.

Having all that in hands, all you need now is to make the appropriate "calls" to the Termux plugin. I've attached the Action Blocks I created for that purpose. One of those is just to make it easier to handle errors and debug the commands, and the other is really executing the SQL statements. You may notice some disabled notifications, I use that just for debugging sometimes.

Hope that helps anyone out there.
Thank you so much for all this detailed explanation!!
You are amazing!
I'm looking forward to trying it out very soon.
Database integration with MD is opens up so much possibility!!
 
I deleted my termux from google store and installed the F-droid version of termux.

I tried to open termux to run the database install : pkg install sqlite

Howerver Termux displayed a screen that seems to say its meant to run only as a tasker helper, not directly.

So it seems I need to write a script to install the pkg. Does that seem right to you or am I missing something?
 
Me too!
I found the first time i had selected the wrong plugin at fdroid. I had first installed termux tasker, not termux.

Now sqlite is installed so i need to test it out!
 

Dimlos

Well-known member
I have no knowledge of sqlite, so I can't do anything difficult, but I can confirm that sqlite works with Termux.
I think it is possible to manipulate the database, although it is necessary to use Termux:Tasker instead of executing commands directly from MacroDroid.
 

Attachments

  • sqlite.jpg
    sqlite.jpg
    443.4 KB · Views: 7
Top