I'm writing a anti-thief on a clean shell using termux. I turned on the backlight with the volume buttons and I want to send photos of "thief" to myself in correspondence in the social network VKontakte. I listen to pressing the power button when the screen is off and secretly take photo by front and back camera and screenshot. Next I want to send photos in VK using PHP. Since I need to listen to the clicks I use getevent command.

script -q -c 'getevent /dev/input/event5' /dev/null | while read code; do
while read line; do
    if [ $line -eq 0 ]; then
    carr=( $code )
    if [ $code1 -eq 0001 ]; then
    if [ $code2 -eq 0074 ]; then
    if [ $code3 -eq 00000001 ]; then
    time=$(date +%d.%m.%Y_%H:%M:%S)
    /data/data/com.termux/files/usr/bin/termux-camera-photo -c 1 /data/data/com.termux/files/usr/bin/q/$time.front.jpg
    /data/data/com.termux/files/usr/bin/termux-camera-photo -c 0 /data/data/com.termux/files/usr/bin/q/$time.back.jpg
    screencap -p /data/data/com.termux/files/usr/bin/q/$time.scr.jpg
    /data/data/com.termux/files/usr/bin/php /data/data/com.termux/files/usr/bin/vkup.php


<?php echo "contact!"; ?>

To run it first I write


Then its script located in /system/bin


Getting an error

CANNOT LINK EXECUTABLE: library "libandroid-glob.so" not found page record for 0xb674008c was not found (block_size=64)

If I write sequentially in command line

/data/data/com.termux/files/usr/bin/php /data/data/com.termux/files/usr/bin/vkup.php


/data/data/com.termux/files/usr/bin/php /data/data/com.termux/files/usr/bin/vkup.php

It works. But in the script does not work. I also noticed that when the command tsu changes

$ tsu

Probably in a script it is necessary to consider it? Or is the problem in something else? Many thanks!!!

  • I kindly ask the close voters to consider that the question (IMO) falls in the domain of power users who like to do things traditionally (scripting, not with x1 app for y1, x2 app for y2, etc.) and scripting is pretty much on-topic here. Please justify if you disagree.
    – Firelord
    Aug 10, 2017 at 16:04
  • @Firelord, sorry I don't quite understand you
    – user191256
    Aug 11, 2017 at 7:30
  • There are currently three close votes pending on your question.
    – Firelord
    Aug 11, 2017 at 7:58
  • @Firelord, I have to remove the question?
    – user191256
    Aug 11, 2017 at 8:28
  • Nah. Even if five normal close voters agree to close, you can always raise the issue on meta. Moreover, a moderator actually answered your post and made it clear in the bottom that such questions are on-topic, so don't worry.
    – Firelord
    Aug 11, 2017 at 11:05

2 Answers 2


When you run the commands interactively, you're not running tsu, letting it complete, and then running the php command. You're running the php command inside tsu's shell. You need to use the -c option to tsu to tell it what command to run:

/data/data/com.termux/files/usr/bin/tsu -c '/data/data/com.termux/files/usr/bin/php /data/data/com.termux/files/usr/bin/vkup.php'

You can see a fuller explanation on this Stack Overflow question. Although end-user shell scripting questions are usually welcomed here, once you start getting to questions that programmers are better able to answer, you're more likely to find help on SO.



tsu -e

The option -e preserves your environment, and should be enough to run your script without errors.

Also note that tsu is just like Linux su, which opens another shell instead of running a command.

You must log in to answer this question.