1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Implement foreground mode for Unix services

Add '--foreground' command line parameter. When provided, it prevents
Unix service from running in daemon mode.
Update help message.
This commit is contained in:
Mikhail Pridushchenko 2017-06-22 18:41:47 +03:00 committed by Joshua Perry
parent d4d17549c4
commit 825931e11c
3 changed files with 8 additions and 1 deletions

View File

@ -2849,6 +2849,12 @@ RESTART_PROCESS:
}
}
}
else if (argc >= 3 && StrCmpi(argv[1], UNIX_SVC_ARG_START) == 0 && StrCmpi(argv[2], UNIX_SVC_ARG_FOREGROUND) == 0)
{
InitMayaqua(false, false, argc, argv);
UnixExecService(name, start, stop);
FreeMayaqua();
}
else
{
// Start normally

View File

@ -141,6 +141,7 @@ typedef void (SERVICE_FUNCTION)();
#define UNIX_SVC_ARG_STOP "stop"
#define UNIX_SVC_ARG_EXEC_SVC "execsvc"
#define UNIX_ARG_EXIT "exit"
#define UNIX_SVC_ARG_FOREGROUND "--foreground"
#define UNIX_SVC_MODE_START 1
#define UNIX_SVC_MODE_STOP 2

View File

@ -1072,7 +1072,7 @@ SVC_HIDE_TRAY_MSG This will hide the tasktray icons when starting %S in user mo
# Concerning services (UNIX)
UNIX_SVC_HELP %S service program\nCopyright (c) SoftEther VPN Project. All Rights Reserved.\n\n%S command usage:\n %S start - Start the %S service.\n %S stop - Stop the %S service if the service has been already started.\n\n
UNIX_SVC_HELP %S service program\nCopyright (c) SoftEther VPN Project. All Rights Reserved.\n\n%S command usage:\n %S start [--foreground] - Start the %S service. '--foreground' parameter prevents switching to daemon mode.\n %S stop - Stop the %S service if the service has been already started.\n\n
UNIX_SVC_STARTED The %S service has been started.\n
UNIX_SVC_STOPPING Stopping the %S service ...\n
UNIX_SVC_STOPPED %S service has been stopped.\n