Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
flock und pid
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
Christian99
Veteran
Veteran


Joined: 28 May 2009
Posts: 1668

PostPosted: Wed Sep 23, 2015 3:16 pm    Post subject: flock und pid Reply with quote

Ich führe einen Befehl mit flock aus:
Code:
flock -n <lockfile> <Befehl>

"$!" gibt mir die pid des flock prozesses, das töten des flock prozesses lässt den eigentlich Befehl aber leider am leben.

wie bekomme ich die pid des eigentlichen Befehls?

Hintergrund: ausführung des "flock..." in .profile im Hintergrund und beim abmelden möchte ich den Prozess beenden. Bisheriger plan war die pid in eine datei zu schreiben, und diese pid in .logout auszulesen un zu killen. Falls jemand einen anderen Vorschlag hat ist mir das auch recht :)
(Btw: funktioniert .logout überhaupt bei graphischen logins, so wie .profile?)
Back to top
View user's profile Send private message
bell
Guru
Guru


Joined: 27 Nov 2007
Posts: 509

PostPosted: Thu Sep 24, 2015 3:02 pm    Post subject: Reply with quote

Wozu benötigst Du eigentlich flock? Btw. was macht es?

/sbin/start-stop-daemon lässt sich auch als normaler User nutzen, es funktionieren halt nur nicht alle Parameter.

Code:
/sbin/start-stop-daemon -m -p /tmp/mypidfile -S -x /usr/bin/wasichwill

Code:
/sbin/start-stop-daemon -K -p /tmp/mypidfile


An sonsten lege mal Deinen flock-Befehl in ein *.sh Skript. Evtl wird Dein Befehl mit beendet wenn das Skript gekillt wird.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum