Giter Site home page Giter Site logo

tandriamirado / alefa Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 97 KB

alefa: Control the launch and execution of other programs.

Home Page: https://twitter.com/tandriamirado

License: GNU General Public License v2.0

Pascal 100.00%
lazarus pascal freepascal exitcode retries scripting script-tool script shell filelist fpc fpc-app lazarus-app

alefa's Introduction

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 [email protected]

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 [email protected] 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.

alefa's People

Contributors

tandriamirado avatar

Watchers

 avatar

Forkers

rezox

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.