AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-126469

necromancini's questions

Martin Hope
necromancini
Asked: 2020-02-03 10:41:50 +0800 CST

当 xscreensaver 空白时,公共计算机需要 pkill chromium

  • 0

我需要的是在 xscreensaver 使屏幕空白时关闭 Chromium(酒店的公共终端,人们对自己的个人安全非常松懈)。附件是我在 xscreensaver-command 的手册页中找到的脚本。

           #!/usr/bin/perl

           my $blanked = 0;
           open (IN, "xscreensaver-command -watch |");
           while (<IN>) {
               if (m/^(BLANK|LOCK)/) {
                   if (!$blanked) {
                       system "sound-off";
                       $blanked = 1;
                   }
               } elsif (m/^UNBLANK/) {
                   system "sound-on";
                   $blanked = 0;
               }
           }

我不知道如何修改它以杀死铬而不是使扬声器静音/取消静音。帮助?[编辑:Waltinator 帮了我很大的忙,但现在还有另一个问题:我收到一个错误,如 Waltinator 答案下方的评论中所述。]

chromium xscreensaver
  • 1 个回答
  • 95 Views
Martin Hope
necromancini
Asked: 2015-08-22 23:43:32 +0800 CST

如何将 gxmessage 设置为在登录时运行,并使退出代码触发事件

  • 0

我想设置一个“计算机使用条款”消息在登录时弹出。如果用户点击“同意”,他们可以继续使用机器;如果他们单击“取消”,它将重新启动机器。这是我所拥有的:

#!/bin/bash

# This script is to set terms of use for this computer and force logged in guest to accept terms.
# If done correctly, it will restart the computer in the event that the terms are not accepted.

gmessage "This is a public terminal. Any use must be suitable for eyes of all ages. Failure to comply will result in your immediate removal from the property without any refund or discount." -center -title "Terms of Use" -default "Accept" -center -buttons "Accept":0,"Decline":1>/dev/null

case $? in
0)
gmessage "Enjoy our public terminal. :)" -center -title "Thank you for accepting the Terms of Use." -buttons "I will!":0;;

1)
(sudo reboot);;

esac

谁能帮我解决这个问题?在我将它放入“启动应用程序”列表之前,它一直按设计工作。我也chown root.root /path/to/script做过chmod u+x /path/to/script。我还编辑了 visudo 以包含该行%sudo ALL=NOPASSWD: /path/to/script,但仍然没有。该脚本运行良好,可以正常弹出我的所有窗口,但是当有人拒绝使用条款时不会重新启动计算机,如果用户不接受这些条款则不会注销用户。我不再卡住了,我的老板正在逼我实施此修复修复已经实施(如果有人试图从我们的公共计算机终端打印一些图形成人材料,卡在打印机缓冲区中;一个小女孩稍后试图打印一些着色书页,我们勉强拦截了成人材料在他们被非成年人看到之前)。

完整的功能代码如下。

#!/bin/bash

# This script is to set terms of use for this computer and force logged in guest to accept terms.
# If done correctly, this script will log the user out in the event that the terms are not accepted.

gmessage -fg red -bg black "   This is a public terminal. Any use must be suitable for eyes of all ages. Failure to comply will result in your immediate removal from the property without any refund or discount." -center -title "Terms of Use" -default "Accept" -center -buttons "Accept":0,"Decline":1>/dev/null

case $? in
0)
gmessage "   Enjoy our public terminal. :)" -center -title "Thank you!" -buttons "I will!":2;;

1)
(killall -u super8guest);;

esac


case $? in

2)
gmessage "Click here when you are finished." -center -title "Cleanup" -buttons "Done":3;;

esac

case $? in

3)
(killall -u super8guest);;

esac
login
  • 1 个回答
  • 117 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve