Operating System - HP-UX
1821244 Members
2763 Online
109632 Solutions
New Discussion юеВ

ticker script \|/-\| .....

 
SOLVED
Go to solution
Bill McNAMARA_1
Honored Contributor

ticker script \|/-\| .....

hi,

I'm looking for a script or binary that will help me stop people pressing Ctrl-C even when my scripts say please wait...!

The tool I'm thinking of is one called ticker that does this:

/
-
|
/
-
|


in the backgroup while the script runs other commands.
The output is echoed to the same line/character..

Anyone know where I can find it. I know it exists on some of the micro linux distros, but couldn't find the source/ hpux binary/script.

Later,
Bill
It works for me (tm)
7 REPLIES 7
Steven Sim Kok Leong
Honored Contributor

Re: ticker script \|/-\| .....

Hi,

Trapping the signal doesn't suit your case?

trap "" 1 2 3
script
trap 1 2 3

Hope this helps. Regards.

Steven Sim Kok Leong
Peter Kloetgen
Esteemed Contributor

Re: ticker script \|/-\| .....

Hi Bill,

you can do a trap like descripted before, but your problem would be, that continuos pressing of ctrl-c would break your script anyway. But if you enter a sleep- command in the action field of trap, this will no longer appear!

example:

trap 'sleep 2; : ' 1,2,3

now you can press ctrl-c several times and the script continues.

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Robin Wakefield
Honored Contributor
Solution

Re: ticker script \|/-\| .....

Hi Bill,

Please try this, see if it helps:

#!/bin/ksh

function ticker
{
while [ -f /tmp/flagfile ] ;do
for char in \| / - \\ ; do
echo $char |awk '{printf ("%s\b",$0) }'
sleep 1
done
done
}

echo hello
echo please wait...
trap "" 2
touch /tmp/flagfile
ticker &
echo trap disabled sleeping...
sleep 10
rm /tmp/flagfile
trap 2
echo trap enabled sleeping...
sleep 10
echo goodbye


Rgds, Robin.
Justo Exposito
Esteemed Contributor

Re: ticker script \|/-\| .....

Hi Bill,

Do you try?
stty kill "^-" intr "^-"

Regards,

Justo.
Help is a Beatiful word
harry d brown jr
Honored Contributor

Re: ticker script \|/-\| .....

Bill,

Wouldn't it be better to just log the idiot off when they press ctrl-c? After a few times of that, maybe they'll learn? Pavlov's Law kicks in here, I believe?


live free or die
harry
Live Free or Die
Justo Exposito
Esteemed Contributor

Re: ticker script \|/-\| .....

Yes Harry, but this trick don't like to your boss, isn't?

Regards,

Justo.
Help is a Beatiful word
Steven Sim Kok Leong
Honored Contributor

Re: ticker script \|/-\| .....

Hi,

I don't think that continuous ctrl-c can break out of the traps. Once the interrupt signal is trapped, no amount of ctrl-c will affect. I have never seen or manage to simulate a string of continuous ctrl-c's that does.

Hope this helps. Regards.

Steven Sim Kok Leong