topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
48.69k stars 12.48k forks source link

How to successfully run commands such as gawk and rsync #3023

Closed zhangweildlh closed 4 years ago

zhangweildlh commented 4 years ago

Hello, my module needs to run gawk, rsync and other commands in service.sh and $MODPATH/system/data-app/jj1.sh. I have installed Neoterm APP; and write in service.sh and $MODPATH/system/data-app/jj1.sh:

export LD_PRELOAD=/data/data/io.neoterm/files/usr/lib/libandroid-support.so export LD_LIBRARY_PATH=/data/data/io.neoterm/files/usr/lib export PATH=/data/data/io.neoterm/files/usr/bin:/data/data/io.neoterm/files/usr/bin/applets:$PATH export BASH=/data/data/io.neoterm/files/usr/bin/bash

in service.sh and $MODPATH/system/data-app/jj1.sh run “which gawk >>/sdcard/gawk.txt”。The results is “/data/data/io.neoterm/files/usr/bin/gawk” But commands such as gawk and rsync cannot be run

Run successfully in Neoterm APP

topjohnwu commented 4 years ago

If your data is encrypted, those files are not accessible at service stage

zhangweildlh commented 4 years ago

If your data is encrypted, those files are not accessible at service stage

Thank you for your reply! I have set a delay in service.sh:" ... ... sleep 15m gawk /data/data/io.neoterm/files/usr/bin/gawk " But these commands still cannot run successfully.

Later, I wrote these commands into the jj1.sh, and set the delay to run the jj1.sh in service.sh. service.sh:" sleep 15m /data/data/io.neoterm/files/usr/bin/sh $MODPATH/system/data-app/jj1.sh"(Run Successfully)

jj1.sh:" export LD_PRELOAD=/data/data/io.neoterm/files/usr/lib/libandroid-support.so export LD_LIBRARY_PATH=/data/data/io.neoterm/files/usr/lib export PATH=/data/data/io.neoterm/files/usr/bin:/data/data/io.neoterm/files/usr/bin/applets:$PATH gawk /data/data/io.neoterm/files/usr/bin/gawk"

But these commands in the jj1.sh still cannot run successfully