lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Aug 3, 2013 at 1:31 AM, Tangent 128 <tangent128@gmail.com> wrote:

Announcing the beta release of sema, a Lua-scripted SErvice MAnager.

Sema is similar to projects like sysvinit, systemd, upstart, and
daemontools. Like systemd and upstart, it centralizes daemon supervision
under a central server that can take complex, user-defined commands;
like sysvinit and daemontools, it tries to keep its methods of operation
as transparent as possible.

Particularly like daemontools, each service has its execution managed by
a run script. SSHD's script looks like:

> #!/usr/bin/env sema
> -- The above shabang line is useful if you mark your control scripts
> executable
>
> -- define a custom command
> function command.reloadConfig()
>     signal(nil, SIGHUP)
> end
>
> while true do
>     runIfUp{"/usr/sbin/sshd", "-D"}
> end

And getty spawning can look like:

> function tty(num) parallel(function()
>     while true do
>         runIfUp {"/sbin/agetty", "-8", "-s", "38400", num, "linux"}
>     end
> end) end
>
> tty "tty1"
> tty "tty2"
> tty "tty3"
> tty "tty4"
> tty "tty5"
> tty "tty6"
>
> waitEvent "quit"

Sema's source and some documentation can be found at
https://github.com/Tangent128/sema/tree/beta ; it was developed on
Linux, but any reports on success or failure at compiling for similar
systems would be appreciated.

~Joseph "Tangent" Wallace


Very interesting. When I look at the innards of a Linux OS I see a lot of scripts and text-based config files in all manner of different formats and languages. Many are shell scripts, some are preprocessed shell scripts or DSLs interpreted by a particular application, and practically every config file has its own unique format. Some are even Perl and Python. I've long thought it'd be quite interesting to try to replace all of them with Lua.


--
Sent from my Game Boy.