No Description

grigruss 7741cea17a Create LICENSE 2 years ago
LICENSE 7741cea17a Create LICENSE 2 years ago cb3a673dc1 Added support for multiple servers 2 years ago c0b6c3800c Обновить '' 2 years ago
en.png 5d49bfaabe add links en-ru to README 2 years ago
ru.png 5d49bfaabe add links en-ru to README 2 years ago
screenshot.en.png a4324ca8c6 add english screenshot 2 years ago
screenshot.png a5e3c78ea6 add screenshot 2 years ago cb3a673dc1 Added support for multiple servers 2 years ago cb3a673dc1 Added support for multiple servers 2 years ago


Language RUS

Build Status

The script for termux (Android only), monitors the specified server. If someone has logged in to the server, the script issues a notification in the phone.



  1. Added support for multiple servers.
  2. Attention: Now it is necessary to specify the notification-id, the fourth parameter. Any numeric value that is not repeated on other servers.

  1. Install
  2. Configuration
  3. Resume


  1. termux, termux-api
  2. Permissions termux and termux-api to access the network and files.
  3. Generate ssh-key to access the server without a password.


  1. Install termux
  2. Install termux-api
  3. Enter termux, do the following:

    apt update
    apt upgrade
    apt install termux-api

    This will install updates, and establish termux communication with termux-api.

  4. Install git

    apt install git
  5. Clone watch-srv

    git clone

    Everything is ready for configure.

Note: by default, termux has only vi, so if you are not friends with it, set the preferred one. For example, I use Midnight Commander ( mc ), which has mcedit, but I like micro more. Both mc and micro are available, so I think there are other editors too.


There are many options to leave the script in the current location, move to the system directory, for example /usr, or make the most logical. Create a ~/bin directory and copy the script there. I will describe the setup using the example ~/bin.

  1. Make directory

    mkdir ~/bin
  2. Copy script

    cp ./watch-srv/ ~/bin/
  3. Open script with our favorite editor, uncomment the last line and replace the login 22 and 0 with the required parameters.

    check "login" "" 22 0

    0 - is a unique identifier for the notification. Each server should be different if you monitor several. For example 0, 1, 2 ...

  4. Generate ssh-key and upload to server

    cd .ssh
    rsync ./
    ssh cat ~/.ssh/termux_key >>~/.ssh/authorized_keys

    The last two commands will require a password. After, no password is required.

  5. Add a task to cron. Remember, the default editor is vi. If you want to use another, here is an example:

    export EDITOR="mcedit"; crontab -e
    # or that
    export EDITOR="micro"; crontab -e

    The task in cron is easy to add. For example, to check every minute in the editor, we write the following line:

        * * * * * ~/bin/

    I decided to do a check every 30 seconds, so I had to use hack:

        * * * * * ~/bin/
        * * * * * (sleep 30; ~/bin/

    Here are two calls to the script, both act in a minute, but the first one works, and the other with a delay of 30 seconds.

    Save and exit

  6. Run cron


    Now, if someone logs in on the server, a notification of this type will appear in the smartphone:


As you can see in the screenshot, there are three buttons:

  1. All right - prevents the permanent notification to appear until the user logs out on the server. After all users have logged out, the script runs in standard mode.
  2. Copy - puts the notification text into the smartphone's system clipboard.
  3. Get full log - gets the whole log and saves it to Downloads/srv-login.log


Everything is quite simple. If you have any suggestions, suggestions, ideas, write to VK@Nixscript or to me FB@grig.russ Instagram@grigruss e-mail.