[Pkg-mono-devel] mono-service2 - how to automate start/stop on Ubuntu (Debian?)

Jo Shields directhex at apebox.org
Tue Nov 2 23:16:50 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
On 02/11/2010 18:59, Ade wrote:
> List,
>
> Firstly, if I'm posting this in the wrong place, I apologise & would
appreciate a re-direct.
>
> I've written a number of Windows Services using .Net 1.1, which have
been deployed all over the place & work fine. However, with M$
introducing Win7 & finally stopping selling XP licences, I've turned to
Linux as an alternative platform.
>
> After a bit of platform-dependant code tweaking, I can now make my
services run just fine in Linux, using the command "mono-service2
<service.name.exe>"; and later stop them using "kill `cat
/tmp/<service.name.exe>`.
>
> All well & good, but I'd like the services to auto-start when the
machine is started; and, ideally, auto-restart if one of them crashes
(as it seems to periodically do)...
>
> I'm guessing the stop/start function should be achieved using an init.d
script; and the monitoring function via a cron job. Unfortunately, my
grasp of init.d is sufficiently shaky to be dangerous, so I'd really
appreciate it if someone could post up an example (just a really simple
one will do) showing how one would use an init.d script to start & stop
a service using mono-service2 as the wrapper.

There's an example init script - /etc/init.d/skeleton.

Just make a copy, and change the "DAEMON" parameter to
/usr/bin/mono-service and DAEMON_ARGS to /path/to/foo.exe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iQEcBAEBAgAGBQJM0JviAAoJEMkPnLkOH60M9uUIAItY2dIyR6bajhGM9pgGR5aY
j2AksxMTzXL03IpuzYZuq9S6BDqTq4uly1bB8ChFIMHGTfZqibPH/diqhLPRLbfX
z67ItsLJmO07Sos4NtFXGtin53MuH25Ms1yDH43nCffLMJAwHuVnEn+R22Rx1ErN
vIxe4i+zuG/e2M/n7Cy5z2Nhdh5k7tA5Sux1/aY76Faqpkj/dKgiWUKVmpxo0o5V
IoCL+I40ifDvu/iJqNMm93oz5jDLItVa+AkyaOYg9RQZf5iGtcyyIoxXIuS1ZmCs
y/8hsyFEaYRXBbH5ZLxSyB0tSIFNjgplx71lJOp/QrEx5IAdjTEuwmz2UrDnoVI=
=/OsH
-----END PGP SIGNATURE-----




More information about the Pkg-mono-devel mailing list