From 3aa04448ffbea90835e1efeabce5f7a2b53338ce Mon Sep 17 00:00:00 2001 From: Andrew Erickson Date: Thu, 28 May 2015 04:40:24 -0700 Subject: [PATCH] scripts: init and default files now specify a process priority. default to priority of 18 (nicelevel of -2). --- scripts/octoprint.default | 4 ++++ scripts/octoprint.init | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/octoprint.default b/scripts/octoprint.default index 0dba7831..2d9a46d7 100644 --- a/scripts/octoprint.default +++ b/scripts/octoprint.default @@ -15,5 +15,9 @@ DAEMON_ARGS="--port=$PORT" # Umask of files octoprint generates, Change this to 000 if running octoprint as its own, separate user UMASK=022 +# Process priority, 0 here will result in a priority 20 process. +# -2 ensures Octoprint has a slight priority over user processes. +NICELEVEL=-2 + # Should we run at startup? START=yes diff --git a/scripts/octoprint.init b/scripts/octoprint.init index 19b10f7c..b0916fae 100644 --- a/scripts/octoprint.init +++ b/scripts/octoprint.init @@ -73,7 +73,8 @@ do_start() if [ $RETVAL != 0 ]; then start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \ - --exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK -- $DAEMON_ARGS + --exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK --nicelevel=$NICELEVEL \ + -- $DAEMON_ARGS RETVAL="$?" fi }