// // mcs -pkg:dotnet service.cs // mono-service service.exe // // Check /var/log/messages // See man mono-service // using System; using System.ServiceProcess; namespace ACME { class TestService : ServiceBase { // ctor. sets up the service public TestService () { this.ServiceName = "TestService"; this.CanPauseAndContinue = true; } // called when the service gets started protected override void OnStart(string[] args) { Console.Error.WriteLine("OnStart"); } // called when the services gets stoped protected override void OnStop() { Console.Error.WriteLine ("OnStop"); } // called on SIGUSR1 protected override void OnPause() { Console.Error.WriteLine ("OnPause"); } // called on SIGUSR2 protected override void OnContinue() { Console.Error.WriteLine ("OnContinue"); } // entry point static void Main () { ServiceBase.Run(new TestService()); } } }