Apakah ada cara untuk 'time out' shell root (misalnya, dalam gnome-terminal) sehingga setelah beberapa waktu tidak mengeluarkan perintah, shell keluar?
Saya mencari solusi yang berfungsi bashpada Fedora, dan kshpada OpenBSD.
Apakah ada cara untuk 'time out' shell root (misalnya, dalam gnome-terminal) sehingga setelah beberapa waktu tidak mengeluarkan perintah, shell keluar?
Saya mencari solusi yang berfungsi bashpada Fedora, dan kshpada OpenBSD.
Jawaban:
Anda dapat mengatur set TMOUTvariabel ke angka dalam hitungan detik yang Anda inginkan untuk menunggu bash sebelum secara otomatis keluar shell jika tidak ada perintah yang dijalankan.
Saya tahu pertanyaan ini terkait Bash & Ksh. Tapi saya pikir saya akan memposting sesuatu yang serupa untuk csh / tcsh, sebagai catatan.
Pada FreeBSD, shell default adalah tcsh. Anda dapat secara otomatis keluar sesi menggunakan autologoutfitur shell tcsh.
Berikut ini akan secara otomatis melakukan sesi setelah satu menit aktivitas idle.
freebsd82# set -r autologout=’1′
(Wait one minute)
freebsd82# auto-logout
Connection to freebsd82 closed.
The tcsh (1) manualnya menjelaskan seperti ini:
autologout (+) The first word is the number of minutes of inactivity before automatic logout. The optional second word is the number of minutes of inactivity before automatic locking. When the shell automatically logs out, it prints `auto-logout', sets the vari- able logout to `automatic' and exits. When the shell automati- cally locks, the user is required to enter his password to con- tinue working. Five incorrect attempts result in automatic logout. Set to `60' (automatic logout after 60 minutes, and no locking) by default in login and superuser shells, but not if the shell thinks it is running under a window system (i.e., the DISPLAY environment variable is set), the tty is a pseudo-tty (pty) or the shell was not so compiled (see the version shell variable). See also the afsuser and logout shell variables.