How to terminate this command
Hi guys how can I terminate this command in BASH script.
$ cat /dev/ttyS0 I terminate this commad by using Ctrl c or Ctrl z. But how can I terminate this automatically? |
kill -HUP pid ?
|
Can't do that because the command:
$ cat /dev/ttyS0 will be put into a script file. like this one !#/bin/sh $ cat /dev/ttyS0 And I will run script file it cron like every 1 minute. If I will use ps and kill. It will be very complocated because every process has different ps id. I just want to cat and redirect the /dev/ttyS0 every 1 minute but "cat /dev/ttyS0" never stops. |
Execute it in background like :
Code:
cat /dev/ttyS0 & |
U can juz use ctrl+ C
or use ps -ax command to kno the process id of the program Suppose the process ID is 2848. Now type kill 2648 (from other terminal as root) and the program will be terminated |
All times are GMT -5. The time now is 05:16 PM. |