test.sh
Code: Select all
#!/bin/sh
ls -l
logout
Code: Select all
#!/bin/sh
ls -l
logout
Code: Select all
TMOUT=xxx
Code: Select all
#!/bin/sh
##########
#
# Project : Cybercafé Timer Project (CTP)
# Started : December 12, 2011
# Last Edited : December 12, 2011
# Module : new-time.sh
# Description : Sets the countdown timer. Syntax is:
# ./new-time.sh <minutes>
#
# This script should only be used in case the server
# is not available. Log in as root in any virtual
# terminal (preferably tty1), change directory to
# /ctp/client/control-panel and execute the script
# together with any required parameter(s).
#
##########
. /ctp/client/support/config.sh
MINUTO=$1
if [ -z "$MINUTO" ]
then
echo "Usage: $0 <minutes>"
else
PLACEHOLDER=`tempfile`
echo "`whoami`@`hostname`" >> $PLACEHOLDER
echo "countdown" >> $PLACEHOLDER
echo "$MINUTO" >> $PLACEHOLDER
mv $PLACEHOLDER $COMMAND_MESSAGE_FILE
clear
echo "Type 'logout' and press the enter key."
fi
# EOF
Code: Select all
echo "Type 'logout' and press the enter key."
Code: Select all
pkill -SIGHUP `basename $SHELL`
Code: Select all
pkill -SIGKILL `basename $SHELL`
Code: Select all
who mom loves
I don't mean to beat a dead horse here but when pkill command as shown, it closed all terminals using that $SHELL.Pilosopong Tasyo wrote:Nevermind. Found a way while experimenting earlier.
Putting
orCode: Select all
pkill -SIGHUP `basename $SHELL`
at key places ought to do it. Thanks for trying though. Marking this thread solved.Code: Select all
pkill -SIGKILL `basename $SHELL`
Code: Select all
kill -SIGKILL $$
Code: Select all
kill -9 $$
Actually, you didn't. I just learned a better way to implement what I'm doing with the snippet of code you posted. It didn't occur to me that using pkill...$SHELL will close other instances of it across other logged in users. Well, considering that my users don't have a use for a terminal session, so it never crossed my mind.mph426 wrote:I don't mean to beat a dead horse here but...
Code: Select all
kill -SIGKILL $$
Code: Select all
$ . new-time.sh 60
Code: Select all
$ ./new-time.sh 60
Code: Select all
pkill -u "$USER"