在计算机锁定时运行 perl 脚本
我编写了一个 perl 脚本,该脚本在用户登录 Windows XP 计算机后立即在后台运行。现在,脚本运行良好,直到用户在计算机上工作为止。但是,如果他锁定计算机或启动屏幕保护程序(这也会很快锁定计算机),则脚本将停止工作。那么,即使电脑处于锁定模式,我怎样才能运行脚本???
I have written a perl script which runs in the background right after a user logs in on a window xp machine. Now the script runs fine until the user is working on the computer. But if he locks the computer or the screen saver is started (which also locks the pc soon) then the script stops working. So how can I get the script running even if the Pc is in locked mode ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
锁定计算机不会停止常规 Perl 脚本,您必须特意创建一个脚本来通知计算机何时锁定并停止运行
尝试一下,运行此
perl -le " for( 1 .. 20 ) { 打印标量 gmtime; sleep 1; } "
锁定计算机,等待几秒钟,解锁它,你会看到它继续运行
Locking a computer will not stop a regular perl script, you have to go out of your way to create a script to notice when a computer is locked and stop running
Try it, run this
perl -le " for( 1 .. 20 ) { print scalar gmtime; sleep 1; } "
lock the computer, wait a few seconds, unlock it, and you'll see it kept running
只是一个想法...您可能必须将 perl 脚本作为 Windows 服务运行才能保持其运行(有点模拟 Unix 的 nohup)。
Just a thought... you might have to run the perl script as a windows service to keep it running (kind of emulating Unix's nohup).