starting and stopping a daemon at user login logout

巧了我就是萌 提交于 2019-12-24 10:57:57

问题


I have a daemon script written in ruby which responds to commands like daemon start and daemon stop. It's executable with shebang #!/usr/bin/env ruby and it works invoked from terminal. I need to start the daemon on login and stop it on logout.

Background info: KDE, zsh.

I already tried to make two separate shell scripts with daemon start and daemon stop and place them in ~/.kde4/Autostart | ~/.kde4/shutdown. The scripts start.sh and stop.sh are working in terminal, but no luck in autostart or shutdown.

I can't put them in .zshrc respectively .zlogout, because I start many login shells in a work session.

So I am stuck :) Any ideas?

Update: F1 => Help :)


回答1:


You could try running the program as an autostart app, and then have it watch to see when its parent (probably the session manager) stops running.



来源:https://stackoverflow.com/questions/3950585/starting-and-stopping-a-daemon-at-user-login-logout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!