我正在使用quickly构建一个应用程序,并且我想要添加一个在后台运行的守护进程。你如何做到这一点?
注意:我尚未尝试过这个方法 :)
将您的守护进程脚本放到您的 Quickly 项目的 bin
目录中,例如: bin/yourapp-launcher
将以下内容添加到 data/yourapp-launcher.desktop
文件中:
[Desktop Entry]
Name=Your App
Exec=/bin/sh -c 'yourapp-launcher'
Type=Application
X-GNOME-Autostart-Delay=30
Icon=yourapp
Comment=
NoDisplay=true
编辑 setup.py
并在 DistUtilsExtra 部分中指定其他 data_files
,例如:
DistUtilsExtra.auto.setup(
name='hello-ubuntu',
version='0.1',
#license='GPL-3',
#author='Your Name',
#author_email='email@ubuntu.com',
#description='UI for managing â¦',
#long_description='Here a longer description',
#url='https://launchpad.net/hello-ubuntu',
cmdclass={'install': InstallAndUpdateDataDirectory},
data_files=[('/etc/xdg/autostart', ['data/yourapp-launcher.desktop'])]
)
import xdg
print xdg.BaseDirectory.xdg_config_home
浏览了 Quickly 文档,似乎 Quickly 不原生支持创建守护进程。因此我建议使用 Python 守护进程库。此外,请参考以下 Python 教程,这些教程可以很容易地与 Quickly 应用程序进行交互:
此外,这个 Stack Overflow 问题 解答了关于 Python 守护进程的内容。