Skip to content

tandriamirado/alefa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

"alefa" means "run", "go", "launch" or "execute" in malagasy language.

"alefa" is a command line utility that allows to control the launch and execution of other programs.

It is often useful to write (more or less) simple scripts to rerun some commands until they "succeed", or to launch other commands indefinitely. To simulate the ability for an app to accept a filelist as a command-line argument, etc.. There are numerous common use cases. No more wasted time:

Such things should be easily automated so that we can do other tasks without being distracted and without having to restart such frustrating commands ourselves by hand: without creating scripts!

"alefa" fixes that. I decided to create it a day that I was tired of creating, modifying and adapting such scripts to make yet simple and routine tasks.

"alefa" returns command or application's last ExitCode, so you could do something depending of the result.

Synopsys

alefa [OPTION]... FILE

Execute FILE. FILE has to be the last argument, after all the OPTIONs.

alefa [OPTION]... "FILE [--OPTIONS]"

Execute FILE with its OPTIONS. FILE has to be the last argument, after all the OPTIONs. Note the double quotes enclosing the executable file and its parameters.

Mandatory arguments to long options are mandatory for short options too.

Options

-h, --help

Show the help screen.

-i, --infinite

Re-run until the end of time (or until interrupted by ctrl + c)

-l --file_list

Run command on each file in the list

-t, --tries=NUMBER

Set number of retries to NUMBER (0 unlimits).

-u, --unlimits

Tries until exit code = 0 (equiv: --tries=0).

-w, --wait=SECONDS

Wait SECONDS seconds between retries. Default: 1 second.

-x, --exitcode

Show exitcode. Can be useful for testing purposes.

Interrupt

As usual, you can interrupt alefa with ctrl + c

Examples

Examples abound:

  • Tries to connect over ssh to a server currently rebooting somewhere in the world, every 5 seconds until it succeeds. In case of connection loss, try again automatically every 5 seconds. When you leave yourself the ssh session by typing "exit", "alefa" also will stop its attempts and you will return to the prompt:

alefa -u -w 5 "ssh my.server.org"

  • Regularly check the available disk space on /tmp during a long copy of huge files in this directory. Interrupt with ctrl + c:

alefa -i -w 10 "df -h /tmp"

  • Tries 10 times only to ping a website, each 30 seconds. Prints the exitcode after each attempt. Open a MessageBox telling you when your Internet connexion is back again:

alefa -t 10 -w 30 -x "ping -c 1 www.debian.org" && gdialog --msgbox "The Internet connexion is back!" 5 40

Bugs

I use "alefa" every day since its creation in 2008. I decided to publish it, being certain that it will be useful. It already is, but many features will be added progressively, and I'll push them as soon as they are publishable. So.. feel free to make suggestions based on your daily needs, and please report bugs.

Feel free to make suggestions based on your daily needs. Report bugs and feature requests at https://github.com/tandriamirado/alefa/issues or to thierry.andriamirado@netsika.net

Websites

https://github.com/tandriamirado/alefa https://sourceforge.net/projects/alefa/ https://launchpad.net/alefa http://thierry.andriamirado.netsika.net

Nota Bene

  • Although alefa is already widely usable, many other convenient features are under development and will come out as you go. Please check back regularly to benefit.
  • Similarly, binaries will be available online.
  • This version now runs on Linux (32bit and 64bit). Later ones will work on windows shortly.

Author

Thierry Andriamirado thierry.andriamirado@netsika.net Twitter: https://twitter.com/tandriamirado

Copyright and License

Copyright 2008-2020 Thierry Andriamirado.

GNU General Public License; either version 2 of the License, or (at your option) any later version.