FOVE Runtimeをプログラマティックに起動・停止することはできますか?
Yes, this is possible and easy.
はい、簡単にできます。
Windows
The FOVE Runtime (also known as the FOVE Service) is simply a Windows Service, which you can enable and disable through standard means. The services' name is FoveRuntime.
FOVE Runtime (FOVE Serviceとも呼ばれます)は通常のWindowsサービスなので、OS標準の方法で起動・停止や有効化・無効化ができます。サービスの名前はFoveRuntimeです。
The On/Off switch in the FOVE Debug Tool and FOVE Tray Application do nothing special other than starting or stopping the Windows Service.
実際、FOVE Debug ToolやFOVE Tray Applicationは、内部でFoveRuntimeサービスを起動・停止しているだけです。
PowerShell
Standard commands can be used. 標準コマンドが使えます。
Start-Service FoveRuntime
Stop-Service FoveRuntime
Get-Service FoveRuntime
C#
You can use the System.ServiceProcess namespace from System.ServiceProcess.dll (make sure to add an assembly reference to it in your project).
System.ServiceProcess.dllのSystem.ServiceProcess namespace内の関数を利用できます。ご利用のプロジェクト内で当該アセンブリへの参照を追加するのを忘れないようご注意ください。
using System.ServiceProcess;
using System.Threading;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
ServiceController service = new ServiceController("FoveRuntime");
// Wait until the service is stopped
// Beware of infinite loop, may want to add a timeout
if (!service.Status.Equals(ServiceControllerStatus.Stopped))
{
service.Stop();
Thread.Sleep(200);
}
// Start the service again
service.Start();
}
}
}
Linux
fove-service is simply an executable that can be launched through any normal means. It responds to kill signals so you can gracefully kill it at will. We recommend never running as root, so sudo should not be used.
fove-serviceは、単なる実行可能ファイルなので、任意の方法で起動することができます。
また、各種POSIXシグナルも無視せず受け取るので、必要に応じてプロセスを直接殺して頂くことも可能です。
なお、fove-serviceをroot権限で実行することはおすすめしません。一般ユーザで、sudo権限無しでご起動下さい。
Kill Signals
If you run fove-service in a terminal, then simply press Ctrl+C to kill it. From another terminal or process you can easily find the process id and send it a kill signal.
仮想端末からfove-serviceを(フォアグラウンドで)起動された場合、Ctrl+Cを押すことでプロセスを停止することができます。
また、fove-serviceのプロセスIDを探して頂ければ、別の端末やプロセスからもプロセスを停止することができます。
fove-service
kill `pidof fove-service`
systemd
FOVE's apt packages include systemd support scripts. Standard commands apply.
FOVEは標準で`systemd`サポートと共に配布されていますので、標準的な`systemd`コマンドでサービスの起動・停止を行うことができます。
systemctl --user start fove-service
systemctl --user stop fove-service
systemctl --user status fove-service
Comments
0 comments
Please sign in to leave a comment.