Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
想做一些关机清尾工作,在 win 和 Linux 平台运行的 Python 脚本如何监听系统关机重启的操作?
decken
·
DecKen
·
Jul 30, 2014
· 4572 views
This topic created in 4504 days ago, the information mentioned may be changed or developed.
监听
脚本
关机
6 replies
•
2014-07-30 23:30:27 +08:00
izoabr
Jul 30, 2014
1
linux下,以前是init6和init0来弄的,win下不知道,是不是注册表里有相关的条目可以动啊。
wy315700
Jul 30, 2014
1
2
关机的时候会给进程发送SIGTERM消息的吧
监听一下就行了
sandtears
Jul 30, 2014
3
Windows 的组策略管理器(gpedit.msc) 里面有关机脚本的设定。
见下图:
Linux 的话可以写在 /etc/rc0.d/ 里面
decken
OP
Jul 30, 2014
4
@
sandtears
用户程序的话没可能让用户这样做吧。我的想法是直接在程序中处理
sandtears
Jul 30, 2014
1
5
@
decken
Linux 的话安装的时候把脚本丢进去就是了。 Windows 的话你看看有没有改注册表的地方
tmqhliu
Jul 30, 2014
1
6
直接用 Win32 API 从消息循环里监听 WM_QUERYENDSESSION 或 WM_ENDSESSION
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
2125 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 48ms ·
UTC 03:52
·
PVG 11:52
·
LAX 19:52
·
JFK 22:52
♥ Do have faith in what you're doing.
❯