The following warnings occurred:
Warning [2] Trying to access array offset on null - Line: 198 - File: inc/plugins/google_seo.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo.php 198 errorHandler->error_callback
/inc/plugins/google_seo/redirect.php 131 google_seo_tid
/inc/class_plugins.php 142 google_seo_redirect_hook
/global.php 100 pluginSystem->run_hooks
/showthread.php 28 require_once
Warning [2] Undefined property: DB_MySQLi::$google_seo_query_limit - Line: 232 - File: inc/plugins/google_seo.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo.php 232 errorHandler->error_callback
/inc/plugins/google_seo/redirect.php 131 google_seo_tid
/inc/class_plugins.php 142 google_seo_redirect_hook
/global.php 100 pluginSystem->run_hooks
/showthread.php 28 require_once
Warning [2] Decrement on type null has no effect, this will change in the next major version of PHP - Line: 232 - File: inc/plugins/google_seo.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo.php 232 errorHandler->error_callback
/inc/plugins/google_seo/redirect.php 131 google_seo_tid
/inc/class_plugins.php 142 google_seo_redirect_hook
/global.php 100 pluginSystem->run_hooks
/showthread.php 28 require_once
Warning [2] Undefined variable $r1comma - Line: 444 - File: inc/plugins/thx.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/thx.php 444 errorHandler->error_callback
/inc/plugins/thx.php 280 build_thank
/inc/class_plugins.php 142 thx
/inc/functions_post.php 936 pluginSystem->run_hooks
/showthread.php 1122 build_postbit
Warning [2] Undefined variable $entries - Line: 444 - File: inc/plugins/thx.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/thx.php 444 errorHandler->error_callback
/inc/plugins/thx.php 280 build_thank
/inc/class_plugins.php 142 thx
/inc/functions_post.php 936 pluginSystem->run_hooks
/showthread.php 1122 build_postbit




Why does a systemd unit immediately closes upon start?
#1
Question 
Hello everyone,

I just installed my first Cuberite server and wanted to configure its startup. Being on an Ubuntu 18.04, I creted a simple systemd service unit to start it:


Code:
[Unit] Description=Cuberite server Wants=network-online.target After=network-online.target [Service] WorkingDirectory=/root/Server ExecStart=/root/Server/Cuberite [Install] WantedBy=multi-user.target

This service successfuly starts and immediately successfuly shuts down, without any error message


Code:
Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] --- Started Log --- Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Cuberite Jenkins clang x64 Release (master) build id: Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] from commit id: 89017dfbbcb0750c07fe067f2b61cde94e4dc8 Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Creating new server instance... Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Reading server config... Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Starting server... Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Info: [19:16:29] Compatible clients: 1.8.x, 1.9.x, 1.10.x, 1.11.x, 1.1 Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Info: [19:16:29] Compatible protocol versions 47, 107, 108, 109, 110, Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Warning: [19:16:29] WebServer: The server will run in unsecured HTTP m Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Info: [19:16:29] Put a valid HTTPS certificate in file 'webadmin/https Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Loaded 755 crafting recipes Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Loaded 67 furnace recipes and 66 fuels Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Loaded 88 brewing recipes Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] -- Loading Plugins -- Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Initialised Core v.15 Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] Initialized ChatLog v.3 Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] [WorldEdit] Enabling WorldEdit v0.1.12 Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:29] -- Loaded 3 Plugins -- Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Info: [19:16:29] Your WorldEdit plugin is up-to-date Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Warning: [19:16:30] World "world_the_end": Did not find an acceptable Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Info: [19:16:30] WebAdmin is running on port(s) 8080 Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] Startup complete, took 895ms! Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] Shutting down server... Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] Unloading worlds... Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] [WorldEdit] Disabling WorldEdit v0.1.12 Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] Disabled Core! Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] Cleaning up... Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] Shutdown successful! Aug 20 19:16:30 minecraft-cuberite Cuberite[3050]: Log: [19:16:30] --- Stopped Log ---


I fixed that somehow by using the forking version:


Code:
[Unit] Description=Cuberite server Wants=network-online.target After=network-online.target [Service] Type=forking WorkingDirectory=/root/Server ExecStart=/root/Server/Cuberite --service [Install] WantedBy=multi-user.target

This is however not a good solution, mostly because systemd works best when the service is in the foreground (it also helps with logs). So I really would like to come back to my initial solution (a service of type simple - per my first unit file).

What is special in the way Cuberite starts so that it immediately shuts down in my case above? Is it the lack of shell? Of tty? Or something else?
Can this be fixed by starting it in a specific way?
Reply
Thanks given by:
#2
Cuberite will terminate if stdin is not present unless the -d flag is used. The github issue has some more information, but not any real solutions for your use case.
Reply
Thanks given by: WoJ
#3
(08-21-2018, 05:07 AM)bearbin Wrote: Cuberite will terminate if stdin is not present unless the -d flag is used. The github issue has some more information, but not any real solutions for your use case.

Thank you, I commented out on the GitHub issue - this will become a problem when more people use systemd (in the better - non-forking - way)
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)