I've just recently aquired a new X10 firecracker kit, which allows me to control parts of my house wired to the system from a universal remote, and my computer, among other things. (Linux works with my coffee machine now ) I've got bottlerocket (linux commandline program to control firecracker) up and running on my P90 debian server, and it controls things very well. The problem I have, is that I do not know the formula to calculate dusk. I know it is based on the date, and my coordinates (in longitude and latitude), but aside from that i'm stumped. How can I calculate dusk?

I've got the linux side down, (cron and at) but I need a script to just pump the formula into a command that can be used.

From a purely hacker poing of view, you might check the source code for the program XTide. Among the many other things it does, it also reports on sunrise and sunset times. You may be able to find what you're looking for there.