Как установить gxmessage, чтобы работать при входе в систему и заставить коды выхода инициировать события

Я хотел установить 'компьютерное сообщение' условий использования для появления при входе в систему. Если бы пользователь нажал 'Agree', то они могли бы продолжить использовать машину; если бы они нажали 'Cancel', то он перезагрузил бы машину. Вот то, что я имел:

#!/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
0
задан 19 September 2017 в 10:05

1 ответ

Это - ответ, я придумал все один, после закрытия и часы исследования. Отправленный здесь в надеждах, что это поможет другим, которые оказываются в аналогичной ситуации.

#!/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

, Если у кого-либо есть идеи о том, как к довольно коду или способам заставить его работать лучше, совместно используйте. Я все еще учусь.

1
ответ дан 28 July 2019 в 19:29

Другие вопросы по тегам:

Похожие вопросы: