Startscript PID statt PPID
Hallo zusammen,
ich habe auf Grundlage des Beispiels gist.github.com/naholyr/4275302 ein Startscript für Java Applikation geschrieben
nun habe ich folgendes Problem
Im Pid File steht nun nicht die PID drin sondern die PPID.
Wenn ich den Prozess wieder beenden möchte funktioniert das leider nicht.
Wie muss ich das Script anpassen das ich die PID und nicht die PPID im PID File habe?
Danke für eure Hilfe
ich habe auf Grundlage des Beispiels gist.github.com/naholyr/4275302 ein Startscript für Java Applikation geschrieben
local CMD="/srv/hibiscus/jameicaserver.sh &> \"$LOGFILE\" & echo \$!"
su -c "$CMD" $RUNAS > "$PIDFILE"
echo 'Service started' >&2
nun habe ich folgendes Problem
Im Pid File steht nun nicht die PID drin sondern die PPID.
Wenn ich den Prozess wieder beenden möchte funktioniert das leider nicht.
Wie muss ich das Script anpassen das ich die PID und nicht die PPID im PID File habe?
Danke für eure Hilfe
Please also mark the comments that contributed to the solution of the article
Content-Key: 310040
Url: https://administrator.de/contentid/310040
Printed on: April 24, 2024 at 12:04 o'clock
5 Comments
Latest comment
Try this
Regards
local CMD="/srv/hibiscus/jameicaserver.sh &> \"$LOGFILE\" & echo $! >\"$PIDFILE\""
su -c "$CMD" $RUNAS
From which process do you need the pid? From the shell script itself or from a process which is started inside the shell-script jameicaserver.sh?
Save the pid inside the script itself, that's all.