Sponsored Content
Full Discussion: ctrl-c in script
Top Forums Shell Programming and Scripting ctrl-c in script Post 302544257 by alexzander18 on Wednesday 3rd of August 2011 09:41:37 AM
Old 08-03-2011
ctrl-c in script

how to send ctrl-c signal in scripts ???
i am executing top command in .exp script

top command gives cpu running activities on your machine
eg

Code:
[root@aaaaa ~]# top
top - 18:41:01 up  8:38,  5 users,  load average: 0.03, 0.16, 0.16
Tasks: 172 total,   1 running, 170 sleeping,   0 stopped,   1 zombie
Cpu(s):  2.6%us,  1.0%sy,  0.4%ni, 92.1%id,  3.5%wa,  0.2%hi,  0.3%si,  0.0%st
Mem:   1942552k total,  1805524k used,   137028k free,   445796k buffers
Swp:  5116692k total,        0k used,  5116692k free,   873612k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                    
16838 root      15   0  144m  52m  14m S 15.8  2.8   1:29.38 npviewer.bin                                                                                               
 3425 root      15   0  286m  17m 8976 S  4.0  0.9   4:55.70 Xorg                                                                                                       
14771 root      15   0  2428 1060  792 S  2.0  0.1   0:21.24 top                                                                                                        
  1 root      15   0  2160  648  556 S  0.0  0.0   0:00.61 init                                                                                                       
   2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.04 migration/0                                                                                                

    3 root      39  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0



to stop top command from exectunig we have to press ctrl-c

i want to send ctrl-c signalin .exp script or a simple bash script



thx in advance

Last edited by pludi; 08-03-2011 at 11:06 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script ctrl+c

How do you make a script so the user can not press ctrl+c and break out of the script? Thanks, :) (1 Reply)
Discussion started by: newtounix
1 Replies

2. Shell Programming and Scripting

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 (12 Replies)
Discussion started by: jhansrod
12 Replies

3. AIX

Disable ctrl-c,ctrl-d,ctrl-d in ksh script

I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
Discussion started by: wtofu
6 Replies

4. Shell Programming and Scripting

terminating script with CTRL+D

Hi, I'm trying to make a script that reads the console input and terminates with CTRL+D. It's absolutely basic but I don't know how to "read" the CTRL+D. I've tried a bunch of things like EOT=^D while //with & without quotations do read input echo $input done while while ] ... (12 Replies)
Discussion started by: sanchopansa
12 Replies

5. UNIX for Advanced & Expert Users

trap ctrl c in shell script

how to trap the ctrl c in unix shell script my script is running in while loop it should not be terminate with ctrl c. if i press ctrl c while running script it shloud ignore the same. please healp.......... thanks in advance (2 Replies)
Discussion started by: arvindng
2 Replies

6. Shell Programming and Scripting

Ctrl-C or Ctrl-Z causing exit the session

H! I have written script where it need to invoke the perl script in background, then write the pid in temp file then bring back the job to foreground. whenever the Ctrl-C or Ctrl-Z is pressed in the script has to exit and prompt should be dispalyed. but this script causing exit from shell session... (2 Replies)
Discussion started by: jramesh1
2 Replies

7. Shell Programming and Scripting

How to handle CTRL+Z or CTRL+C in shells script?

Hi, while executing shell script, in the middle of the process, if we kill the shell script( ctrl+z or ctrl+c), script will be killed and the files which using for the script will be in the folder. How to handle those scenarios. Is there any possibilities, if user breaks the script, I need to... (3 Replies)
Discussion started by: ckchelladurai
3 Replies

8. Shell Programming and Scripting

ctrl-c in shell script

The below script has Perl script in it where it gives the usage details. filer.sh echo echo -en "Enter filer : " read filer echo "test.pl -f $filer -F L" Output ========= The following hosts are online and available: Name Total Allocated Used ... (2 Replies)
Discussion started by: nareshkumar522
2 Replies

9. UNIX for Dummies Questions & Answers

Ctrl-V + Ctrl-J for newline character does not work inside vi editor

Hi friends, I am trying to add a newline char ('\n') between the query and the commit statement in the following shell script. #! /bin/sh echo "select * from tab; commit;" > data.sql I have tried typing in "Ctrl-V + Ctrl-J" combination which has inserted ^@ (NUL) character but the commit... (1 Reply)
Discussion started by: royalibrahim
1 Replies

10. Shell Programming and Scripting

Automation of keyboard inputs..like Ctrl+d and Ctrl+a

Hi..! I'm stuck with my automation of starting a process and keeping it running even after the current ssh session has exited.. So i'm trying to use command 'screen'. which is doing exactly what i wanted, But the problem is automation of the same. i will have to press Ctrl+a and Ctrl+d for... (2 Replies)
Discussion started by: chandana hs
2 Replies
topsyscall(1m)							   USER COMMANDS						    topsyscall(1m)

NAME
topsyscall - top syscalls by syscall name. Uses DTrace. SYNOPSIS
topsyscall [-Cs] [interval [count]] DESCRIPTION
This program continually prints a report of the top system calls, and refreshes the display every 1 second or as specified at the command line. Since this uses DTrace, only users with root privileges can run this command. OPTIONS
-C don't clear the screen -s print per second values EXAMPLES
Default output, 1 second updates, # topsyscall Print every 5 seconds, # topsyscall 5 Print a scrolling output, # topsyscall -C FIELDS
load avg load averages, see uptime(1) syscalls total syscalls in this interval syscalls/s syscalls per second SYSCALL system call name COUNT total syscalls in this interval COUNT/s syscalls per second DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver- bose descriptions explaining the output. EXIT
topsyscall will run until Ctrl-C is hit, or the specified interval is reached. AUTHOR
Brendan Gregg [Sydney, Australia] SEE ALSO
dtrace(1M), prstat(1M) version 0.90 Jun 13, 2005 topsyscall(1m)
All times are GMT -4. The time now is 11:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy