[Other Tools & General Discussion] NoTengoBattery:
Hello XDA comunity!

I want to share you a very useful tool that I have created, its name is: "kielyd".

What's keilyd?

Keilyd is a BASH daemon that constantly dumps the system's logs, warnings and other useful info in a easy-to-share "ZIP" with the main purpose to create a very informative and useful bug report.

keilyd is expansible and configurable. It's very easy to add new features because BASH interacts directly with the Linux/BSD commands in the Android System.

How does it works?

Keilyd is launched at device boot, with the "init.d support" and as root (see requeriments below). After launched, keilyd relaunches itself in a "daemon mode", that runs in the background, then, it dumps several information in the /sdcard and compress it in a single zip, so, the user can send that zip (in fact, are 2 zip's or more if you use the "snapshot" feature) to the developer of their ROM, to a forum or send it to a 3rd party developer and report a bug with all the system logs included.

Keilyd stores 2 zips: the first one is the current log (the "very last file") and the second one is the last log before keilyd were launched again.

If you won't enable de daemon, you can create a single zip when you use the "snapshot" feature, if you take two or more snapshots in the same minute, the ZIP will be the same, otherwise, one script per different minute will be created. The Snapshot feature can create as much zips as needed.

What info is collected?

That's a good question!

The info that is collected is (this applies ONLY for a vanilla copy of keilyd):

Kernel log (aka "dmesg") and other kernel info

Logcat (aka "logcat")

List of process running and memory statics

A copy of all tweaks in init.d (including keilyd itself)

A copy of build.prop and sysctl.conf

A copy of /proc/config.gz (if exists)

Some cpuinfo

Mounted filesystems and usage

How does this "daemon" can help me?

Developer:

Have you had the need to get some system log from a user?

Probably the answer is "yes", but, the user may have no idea how to do that, so, you have to give them a "step-by-step" guide of "how to get a system log in the terminal".

This simplifies the process, so, the user can report a bug with logs with no terminal (if the daemon is enabled) or with a single command that looks like

keilyd --snap

User:

Well, the complement of the developer... You can share "golden" information just by sending 2 zips files to the dev. Minimal Android knowledge is the only prerequisite if the daemon is working as spected.

This daemon is not a demon, but it can be very bad if not implemented as spected. Please, ensure that ALL THE COMMANDS ARE KNOWN and that THERE IS NO PORPRIETARY interference.

Why BASH?

A good idea is to create a daemon in C/C++ and share it as a "binary", BUT, as we are recolecting information from the device, the user must have to be concient of what are the script recollecting, if the user can't read bash, it can ask to a 3rd developer. You can feel safer because it's under the GPLv3 licence!

In addition, BASH run in (almost) any UNIX based OS, including but not limited to Apple OS X, GNU/Linux, Android, iPhone OS, etc...

This prevent a "blind trust" from the user, and give them facility of enable-disable the script, add features and so on.

Requeriments

- A rooted device

- Busybox (or run-parts)

- init.d support

- BASH 4.3.x ONLY SUPPORTED by the moment.

- Terminal emulator/HIDE]

How can I include it in my ROM?

Take a look of my repo in GitHub, it contains the last version of keilyd and the implementation during compilation in the Makefile.

If you are a ROM modder, download the latest version from above, include init.d and bash support in you ROM.

Or you can create a CWM/TWRP/Philz... flashable zip (it would be great!)

Users: how to use

When something goes weird, open the terminal emulator and write:

keilyd --snap

and send to the developer all zips in

/sdcard/keilyd/out

type

keilyd --help

and a helpful message will be printed.

If something goes wrong and you need to reboot the device (or the device reboots itself), just send both zips to the developer or the forum where you are asking help (This feature only works if the daemon is enabled).

Developers: how to use

You can add/remove things in order to fit your needs, the only thing that we ask you is that you write the whole script in BASH, without "blobs" that may private the user from know what is exacly logged and stored.

If some user sends you the zip, you will notice that the files are plain-text, and you can view it in any text editor.

TODO:

List all apps installed (system and user)

Secure "user-modificable" settings (Allmost DONE)

A graphical interface (an app) to manage the daemon

A flashable ZIP

Aports and sugestions are WELLCOME, please, coment in the box below

Install redistributable package:

If the avobe requeriments are meet...

1. Open this GItHub URL

Click in the "Download ZIP" icon in the right.

2. Put the zip in your phone

3. Unzip it.

4. If you want to use the script... A; otherwise, B.

A.

a. Open the terminal emulator.

b. cd to the folder that contains

install.sh

c. As root, type "

sh install.sh

" in the terminal.

B.

a. Open ES File Explorer

b. Enable root explorer and mount /system as rw

c. Copy

daemon/18keily

to

/etc/init.d

d. Tap and hold the

18keily

file and open the poperties

e. Change te permisions to

rwx r-x r-x

f. Copy the

redistrib/bash

file to

/system/xbin/bash

g. Change the permisions as above.

h. Symlink /etc/init.d/18keily to /system/xbin/keilyd

i. Reboot

NOTE:

Keilyd can be used in 2 ways:

1. As a daemon that does it job without human interaction, that constatantely and automaticaly creates 2 zips in the output directory.

2. As a Script that only needs to be called with the '--snap' parameter, but it requieres human interaction and does not constantely repeat the process.

Use the first one if you are a beta tester, or if you know that you ROM can hang sudently. Recomended for Unstable ROM'S.

Use the Last One if your ROM is stable or official, but you want to do a bug report.

You can allways use the second option if you use the first one.

By default, the daemon is disabled. You can enable if you change the "ENABLED" variable to "Y". I personally recommend values for "MINS" between 5 and 15.

BUGS REPORTS in the GITHUB REPOSITORY