How to secure my script from Ctrl-C

Hi all

I am looking for a way to ensure that once a user is logged in and running a script, he cannot break out of it.

Thanks

J

Look into the command trap

I have tried checking this out. I am on AIX 5.2 and there is no man entry for this. Can anyone give me an idea on how to use it ?

Thank you

what shell are you using?

if using ksh, 'man ksh' and search for 'trap'

I am using ksh. I have checked it out and all it talks of is

-e Executes the ERR trap, if set, and exits if a command has a nonzero exit
status. This mode is disabled while reading profiles.

What next....

Thanks

Solaris' "trap" is more descriptive then that.
Are you sure you don't see anything more about 'trap' in 'man ksh'?

100%. Anyone with an idea of what is to be done in AIX.

Thanks

J

For more go here

Any ideas on how do I use this ?

The short of it:

trap "" 2

Thanks for the reply, however this still allows the user to break out with Ctrl-C.

Any ideas.

Run this script and see what happens when you try to ctrl-c in the first 20 seconds after the script starts. Then try to ctrl-c after you see the echo statement.

#! /bin/ksh

trap "" 2

sleep 20
echo "done with first sleep. You may interrupt now."
trap "exit" 2
sleep 20

Thanks. This has done the trick. Could there be a reason why if I had #!/usr/bin/ksh it would not work ?

Regards

J