dettaching process from parent

Im running multiple applications with an updater. however I dont want the childs to be killed nor stopped when the updater itself needs an update. I create the childs using Runtime command execution. Environment: Debian Linux Server.
48 Replies
JavaBot
JavaBot10mo ago
This post has been reserved for your question.
Hey @Hype_the_Time! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st10mo ago
start it using nohup?
Hype_the_Time
Hype_the_TimeOP10mo ago
nohup (other command)?
dan1st
dan1st10mo ago
yes it's located at /usr/bin/nohup
tjoener
tjoener10mo ago
or run it in a screen? Or just make a quick init script for it?
Hype_the_Time
Hype_the_TimeOP10mo ago
tried it with this: nohup java -jar /home/dummy/testbbonline.jar true & does not work. if i restart it via systemd the childs are killed.
dan1st
dan1st10mo ago
& is a shell builtin don't do that
Hype_the_Time
Hype_the_TimeOP10mo ago
its part of bash -c command that i think about it. remove that?
dan1st
dan1st10mo ago
if you want to use &, you'd need bash -c but there's no reason to do that
Hype_the_Time
Hype_the_TimeOP10mo ago
there is in another section. also means i need to run it in e execution serive. also its still remains in the CGROUP
No description
dan1st
dan1st10mo ago
What do you mean with execution section?
Hype_the_Time
Hype_the_TimeOP10mo ago
execution service
dan1st
dan1st10mo ago
What do you mean with that? and what's the issue with it being in the cgroup?
Hype_the_Time
Hype_the_TimeOP10mo ago
a handler to run runnables. it allows you to do some fancy things like run this task in 10 minutes
dan1st
dan1st10mo ago
So something like cron and what's the issue with it now?
Hype_the_Time
Hype_the_TimeOP10mo ago
i think so thats what the issue is about. i need to get it out of it because thats probably whats killing it atm.
dan1st
dan1st10mo ago
And with nohup it's still killing it?
Hype_the_Time
Hype_the_TimeOP10mo ago
because as soon as i restart it with serive restart that thing gets sniped yes
dan1st
dan1st10mo ago
Anyways you could create a second systemd service and then run systemctl start --user otherservice or something like that from your java program
Hype_the_Time
Hype_the_TimeOP10mo ago
what do you mean with that --user and what does that do? that i can allow do it even though im not root or sth?
dan1st
dan1st10mo ago
--user means it runs under the current user and it doesn't require root, yes
Hype_the_Time
Hype_the_TimeOP10mo ago
cause i am NOPT running java as root
dan1st
dan1st10mo ago
With --user, you don't need root
Hype_the_Time
Hype_the_TimeOP10mo ago
hm ok
dan1st
dan1st10mo ago
though it might be more difficult to set up
Hype_the_Time
Hype_the_TimeOP10mo ago
i mean i set the manager up that way. im thinking about whether i should go with that
dan1st
dan1st10mo ago
With --user?
Hype_the_Time
Hype_the_TimeOP10mo ago
i set the user for the manager in the system service
dan1st
dan1st10mo ago
you could also try something like https://unix.stackexchange.com/a/600770/378034
Unix & Linux Stack Exchange
cgroups: how to detach a process from cgroup
I have created a cgroup mygroup in my system and running a process under it cgexec -g memory,cpu:groupname/mygroup someprocess Now after some time when i feel there is no need to worry about the c...
dan1st
dan1st10mo ago
yeah I meant that the --user may make a bit more difficult to set up the service definition
Hype_the_Time
Hype_the_TimeOP10mo ago
sc out of definition
No description
dan1st
dan1st10mo ago
User= is not the same as the --user option
Hype_the_Time
Hype_the_TimeOP10mo ago
what would be the default cgroup whenj running it as a normal user?
dan1st
dan1st10mo ago
you mean without it being called from a systemd service?
Hype_the_Time
Hype_the_TimeOP10mo ago
yes
dan1st
dan1st10mo ago
I think it would be in the root cgroup
Hype_the_Time
Hype_the_TimeOP10mo ago
means which command prefix? didnt find a man entry
dan1st
dan1st10mo ago
? command prefix for what?
Hype_the_Time
Hype_the_TimeOP10mo ago
want able to find out how to put it into cgroup. found out that cgexec was not instealled. ima have a look at cgexec man entry
JavaBot
JavaBot10mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Hype_the_Time
Hype_the_TimeOP10mo ago
ok so I had a depper look and it seems like i would need to use root/sudo in order to modify cgroups. so i think i should go with a user system service. However i tried multiple setups had a look at posts on how to do it but I always fail because of the following error / request for root priviledges: dummy@xyz:~$ systemctl --user daemon-reload Failed to connect to bus: No medium found
dan1st
dan1st10mo ago
I don't think daemon-reload works with --user
Hype_the_Time
Hype_the_TimeOP10mo ago
it should but i get that for any service related user command
dan1st
dan1st10mo ago
my idea was that you can use systemctl start etc with --user ? daemon-reload reloads all services AFAIK
Hype_the_Time
Hype_the_TimeOP10mo ago
systemctl start --user bbmainbot.service Failed to connect to bus: No medium found same error. one of the turorials in that area used it thats why i think it should work but what you just said doesnt work either cause of same errror
dan1st
dan1st10mo ago
idk what exactly you need to set up to use --user but the service definition needs to be done in a specific way
Hype_the_Time
Hype_the_TimeOP10mo ago
yeah ~/.config/systemd/user/
JavaBot
JavaBot10mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server