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
⌛
This post has been reserved for your question.
Hey @Hype_the_Time! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
start it using
nohup
?nohup (other command)?
yes
it's located at
/usr/bin/nohup
or run it in a screen? Or just make a quick init script for it?
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.&
is a shell builtin
don't do thatits part of bash -c command that i think about it. remove that?
if you want to use
&
, you'd need bash -c
but there's no reason to do thatthere is in another section. also means i need to run it in e execution serive. also its still remains in the CGROUP
What do you mean with execution section?
execution service
What do you mean with that?
and what's the issue with it being in the cgroup?
a handler to run runnables.
it allows you to do some fancy things like run this task in 10 minutes
So something like cron
and what's the issue with it now?
i think so
thats what the issue is about. i need to get it out of it because thats probably whats killing it atm.
And with nohup it's still killing it?
because as soon as i restart it with serive restart that thing gets sniped
yes
Anyways you could create a second systemd service
and then run
systemctl start --user otherservice
or something like that from your java programwhat do you mean with that --user and what does that do?
that i can allow do it even though im not root or sth?
--user
means it runs under the current user
and it doesn't require root, yescause i am NOPT running java as root
With
--user
, you don't need roothm ok
though it might be more difficult to set up
i mean i set the manager up that way.
im thinking about whether i should go with that
With
--user
?i set the user for the manager in the system service
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...
yeah I meant that the
--user
may make a bit more difficult to set up the service definitionsc out of definition
User=
is not the same as the --user
optionwhat would be the default cgroup whenj running it as a normal user?
you mean without it being called from a systemd service?
yes
I think it would be in the root cgroup
means which command prefix?
didnt find a man entry
?
command prefix for what?
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
💤
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.
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
I don't think
daemon-reload
works with --user
it should but i get that for any service related user command
my idea was that you can use
systemctl start
etc with --user
?
daemon-reload
reloads all services AFAIKsystemctl 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
idk what exactly you need to set up to use
--user
but the service definition needs to be done in a specific wayyeah ~/.config/systemd/user/
💤
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.