cerebrate / wabash

A utility to hold a WSL session-set open continuously. Works in conjunction with wabashd.
Microsoft Public License
81 stars 4 forks source link

How would I run a custom command? #6

Closed norseghost closed 7 years ago

norseghost commented 7 years ago

Hi. I have a POP3 email proxy I'd like to run (github.com/dk/Net-Eboks), but can't figure out how to run a custom service (well, running a perl script in the background) with wabashd.

I've tried the included debian rc script (errors out), writing an upstart thing (also errors out), and adding the command to /etc/rc,local (seems to do nothing), with corresponding /usr/bin/wabashd.exe.config entries.

cerebrate commented 7 years ago

I may not be the best person to ask about this, I'm afraid, mostly because I'm much less familiar with the Linux side of WSL than with the Windows side.

Basically, wabashd will start anything that can be controlled through /usr/sbin/service (which is to say, System V init scripts or upstart jobs), per man 8 service, by listing the service name in wabash.exe.config (note, not wabashd.exe.config; this is done on the Windows side).

From what I know of how this works, the included rc script ( https://github.com/dk/Net-Eboks/blob/master/example/eboks2pop.debian ) placed in /etc/init.d ought to make it controllable this way, and I don't see anything obviously wrong with it, or at least I'm not sufficiently familiar with the Linux daemon-management methodology to spot it.

All of which is to say "if you can get it to start and stop manually with service(8), it'll work with wabash, but making that work is a bit beyond my expertise; try http://askubuntu.com/ ?" Sorry.

norseghost commented 7 years ago

Ok.

I shall intensify my efforts into getting the init script working.

If I place the example config next to wabash.exe, I get an error- can't remember the specific text, but something about invalid side-by-side configuration.

On Sat, 7 Jan 2017 at 18.02, Alistair Young notifications@github.com wrote:

I may not be the best person to ask about this, I'm afraid, mostly because I'm much less familiar with the Linux side of WSL than with the Windows side.

Basically, wabashd will start anything that can be controlled through /usr/sbin/service (which is to say, System V init scripts or upstart jobs), per man 8 service, by listing the service name in wabash.exe.config (note, not wabashd.exe.config; this is done on the Windows side).

From what I know of how this works, the included rc script ( https://github.com/dk/Net-Eboks/blob/master/example/eboks2pop.debian ) placed in /etc/init.d ought to make it controllable this way, and I don't see anything obviously wrong with it, or at least I'm not sufficiently familiar with the Linux daemon-management methodology to spot it.

All of which is to say "if you can get it to start and stop manually with service(8), it'll work with wabash, but making that work is a bit beyond my expertise; try http://askubuntu.com/ ?" Sorry.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cerebrate/wabash/issues/6#issuecomment-271095597, or mute the thread https://github.com/notifications/unsubscribe-auth/AD1HcRuPm_uEYrETL6Amfrv4_B_GvwP2ks5rP8USgaJpZM4LdZQJ .

cerebrate commented 7 years ago

You shouldn't need to place another config there: there should be a wabash.exe.config there already. If you open that up in an editor, there's a section that looks like this by default:

    <applicationSettings>
        <ArkaneSystems.Wabash.Properties.Settings>
            <setting name="Services" serializeAs="Xml">
                <value>
                    <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                        <string>rsyslog</string>
                        <string>binfmt-support</string>
                        <string>dbus</string>
                        <string>cron</string>
                        <string>atd</string>
                    </ArrayOfString>
                </value>
            </setting>
        </ArkaneSystems.Wabash.Properties.Settings>
    </applicationSettings>

If you add a new line reading <string>eboks2pop</string> (or whatever the name of your init script is in between the <string> tags) next to the other service names in the middle of this section, that should be all the config you need to do for wabash, as long as the init script is working.

norseghost commented 7 years ago

Huh. I installed wabash with chocolatey, and didn't find it. On Sat, 7 Jan 2017 at 18.26, Alistair Young notifications@github.com wrote:

You shouldn't need to place another config there: there should be a wabash.exe.config there already. If you open that up in an editor, there's a section that looks like this by default:

<applicationSettings>

    <ArkaneSystems.Wabash.Properties.Settings>

        <setting name="Services" serializeAs="Xml">

            <value>

                <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

                    <string>rsyslog</string>

                    <string>binfmt-support</string>

                    <string>dbus</string>

                    <string>cron</string>

                    <string>atd</string>

                </ArrayOfString>

            </value>

        </setting>

    </ArkaneSystems.Wabash.Properties.Settings>

</applicationSettings>

If you add a new line reading eboks2pop (or whatever the name of your init script is in between the tags) next to the other service names in the middle of this section, that should be all the config you need to do for wabash, as long as the init script is working.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cerebrate/wabash/issues/6#issuecomment-271097108, or mute the thread https://github.com/notifications/unsubscribe-auth/AD1HcX0slOFDlMIlEIsjUpGRDZuKo9d3ks5rP8rggaJpZM4LdZQJ .

cerebrate commented 7 years ago

...oops, I've just realized a problem with the documentation.

I'm guessing you're looking at the wabash.exe in /ProgramData/Chocolatey/bin? There's not one there because that's not the "real" wabash.exe, that's the chocolatey-created shim which points at the actual wabash.exe in /ProgramData/Chocolatey/lib/wabash/tools. That one should have the wabash.exe.config next to it.

Thanks, and I'll update the README.

norseghost commented 7 years ago

:D On Sat, 7 Jan 2017 at 18.36, Alistair Young notifications@github.com wrote:

...oops, I've just realized a problem with the documentation.

I'm guessing you're looking at the wabash.exe in /ProgramData/Chocolatey/bin? There's not one there because that's not the "real" wabash.exe, that's the chocolatey-created shim which points at the actual wabash.exe in /ProgramData/Chocolatey/lib/wabash/tools. That one should have the wabash.exe.config next to it.

Thanks, and I'll update the README.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cerebrate/wabash/issues/6#issuecomment-271097695, or mute the thread https://github.com/notifications/unsubscribe-auth/AD1HcSrx93uYpBOEEYcaK6BO6M9blTB_ks5rP80BgaJpZM4LdZQJ .

norseghost commented 7 years ago

so... turns out, this was classic PEBKAC... I'd forgotten to account for windows line endings. A quick CRLF -> LF conversion, and off to the races i went.