| Server IP : 82.208.35.60 / Your IP : 216.73.217.39 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/sysutils/lsyncd/files/ |
Upload File : |
--- lsyncd.c.orig 2018-03-09 12:39:11 UTC
+++ lsyncd.c
@@ -1614,10 +1614,21 @@ l_configure( lua_State *L )
openlog( log_ident, 0, settings.log_facility );
}
+#ifdef __FreeBSD__
+ if( !settings.nodaemon )
+ {
+ // daemonnize is already done before open_inotify with FreeBSD.
+ // just writing pidfile is needed at this time.
+ logstring( "Normal", "--- Startup, daemonizing ---" );
+ if (settings.pidfile)
+ {
+ write_pidfile( L, settings.pidfile );
+ }
+ }
+#endif
if( !settings.nodaemon && !is_daemon )
{
logstring( "Normal", "--- Startup, daemonizing ---" );
-
daemonize( L, settings.pidfile );
}
else
@@ -2433,6 +2444,10 @@ main1( int argc, char *argv[] )
int argp = 1;
+#ifdef __FreeBSD__
+ static bool call_daemonize = true;
+#endif
+
// load Lua
L = luaL_newstate( );
@@ -2482,6 +2497,14 @@ main1( int argc, char *argv[] )
while( i < argc )
{
+#ifdef __FreeBSD__
+ if (!strcmp (argv[i], "-nodaemon" ))
+ {
+ call_daemonize = false;
+ i++;
+ continue;
+ }
+#endif
if(
strcmp( argv[ i ], "-log" ) &&
strcmp( argv[ i ], "--log" )
@@ -2796,6 +2819,14 @@ main1( int argc, char *argv[] )
}
}
+#ifdef __FreeBSD__
+ // daemonize should be done before open_inofity with FreeBSD.
+ if( call_daemonize )
+ {
+ daemonize( L, NULL );
+ }
+#endif
+
#ifdef WITH_INOTIFY
open_inotify( L );
#endif