OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [stop-linuxes.sh] - Blame information for rev 587

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 548 jeremybenn
#!/bin/bash
2
 
3
# Copyright (C) 2011 Embecosm Limited
4
 
5
# Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
6
 
7
# This file is a script to stop a group of Linux instances
8
 
9
# This program is free software; you can redistribute it and/or modify it
10
# under the terms of the GNU General Public License as published by the Free
11
# Software Foundation; either version 3 of the License, or (at your option)
12
# any later version.
13
 
14
# This program is distributed in the hope that it will be useful, but WITHOUT
15
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17
# more details.
18
 
19
 
20
# You should have received a copy of the GNU General Public License along
21
# with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 
23
# ------------------------------------------------------------------------------
24
 
25
# Stop up a batch of linux sessions.
26
 
27
# The input for this is a string of PIDs - the output of start-linuxes.sh. We
28
# use the PID to kill the Linux process.
29
 
30
for pid in $*
31
do
32
    # Find all the processes of which this is parent and kill them
33
    for cpid in `ps h --ppid ${pid} | sed -e 's/ *\([[:digit:]]*\).*$/\1/'`
34
    do
35
        kill -KILL ${cpid} > /dev/null 2>&1
36
    done
37
 
38
    # Kill the main process. Using -INT should allow the session to finish
39
    # writing to the log.
40
    kill -INT ${pid} > /dev/null 2>&1
41
    kill -HUP ${pid} > /dev/null 2>&1
42
 
43
done
44
 
45
# We could add more brutal commands here to get rid of xterms and TUN/TAP
46
# connections. However this would just kill everything, not the named linuxes,
47
# potentially inconveniencing others.
48
# kill `ps x | grep 'xterm *-S.*/.*' | sed -e 's/\(.....\).*$/\1/'`
49
# fuser -k /dev/net/tun

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.