docker-systemctl-replacement icon indicating copy to clipboard operation
docker-systemctl-replacement copied to clipboard

feature: please support "Nice"

Open onlyjob opened this issue 5 years ago • 3 comments

Please support setting Nice level in .service files, as per specification.

Thanks.

onlyjob avatar Apr 23 '20 12:04 onlyjob

Is it something that goes into execve_from() to modify the child processes?

def execve_from(self, conf, cmd, env):
    """ this code is commonly run in a child process // returns exit-code"""
    inp = open("/dev/zero")
    out = self.open_journal_log(conf)
    os.dup2(inp.fileno(), sys.stdin.fileno())
    os.dup2(out.fileno(), sys.stdout.fileno())
    os.dup2(out.fileno(), sys.stderr.fileno())
    runuser = self.get_User(conf)
    rungroup = self.get_Group(conf)
    xgroups = self.get_SupplementaryGroups(conf)
    envs = shutil_setuid(runuser, rungroup, xgroups)
    badpath = self.chdir_workingdir(conf) # some dirs need setuid before
    if badpath:
        logg.error("(%s): bad workingdir: '%s'", shell_cmd(cmd), badpath)
        sys.exit(1)
    env = self.extend_exec_env(env)
    env.update(envs) # set $HOME to ~$USER
    os.execve(cmd[0], cmd, env)

gdraheim avatar Apr 23 '20 18:04 gdraheim

I'm not familiar enough with codebase to have an opinion, if the question was addressed to me...

onlyjob avatar May 01 '20 00:05 onlyjob

I think that Python does export the nice-API but I am not expert either. The problem here is that I don't have a use case for it and I don't know how to test the thing to actually work. So for the time being I am skipping the implementation on my own - may be someone else can provide a patch somewhen.

gdraheim avatar Aug 09 '20 10:08 gdraheim