3 # Copyright (C) 2016 NIWA Hideyuki
5 FULCONDRIVER=`fulcon driver-name`
6 PATH=/usr/lib/slot-os/lib:/usr/lib/fulcon/driver/$FULCONDRIVER:/usr/lib/fulcon/lib:$PATH
8 FULCONDIR=/var/lib/fulcon
9 SLOTOSDIR=/var/lib/slot-os
13 echo "usage: list [ -c ] [ SLOT_NUMBER ...]"
17 ls -f --ind=none $1 | sed '/^\.\{1,2\}$/d'
30 shift `expr $OPTIND - 1`
35 CNAME=`printf "slot%02d" $i`
36 STATUS=`fulcon-status $CNAME`
37 if [ ! -f $FULCONDIR/container/$CNAME/imagename ]; then
40 IMAGE=`sed -e 's%fulcon/%%' $FULCONDIR/container/$CNAME/imagename`
44 if [ x"$STATUS" == x"RUNNING" ]; then
45 IPADDR=`fulcon-ip $CNAME`
48 if [ -d $SLOTOSDIR/slot/$i/net ]; then
49 for k in `lsdir $SLOTOSDIR/slot/$i/net`
51 IP1=`awk '{printf "%s ",$3}' $SLOTOSDIR/slot/$i/net/$k`
56 # autostart information
57 if [ -f $SLOTOSDIR/slot/$i/autostart ]; then
63 if [ -d $SLOTOSDIR/slot/$i ]; then
64 printf "%2d : %8s %s %3s%% %3s %s %1s %s " \
66 `cat $SLOTOSDIR/slot/$i/cpu` \
67 `cat $SLOTOSDIR/slot/$i/cpuset` \
68 `cat $SLOTOSDIR/slot/$i/memory` \
82 NUM=`echo $NUM | sed -e 's/slot//'`
85 echo "error: slot $i is not exist"
91 if [ -d $SLOTOSDIR/slot/$NUM ]; then
92 CNAME=`cat $SLOTOSDIR/slot/$NUM/fulcon`
95 echo "error: slot $NUM is not exist"
100 if [ ! -d $SLOTOSDIR/slot -o ! -d $SLOTOSDIR/slot/0 ]; then
107 if [ $# -eq 0 -o x"$1" == x"list" ]; then
108 NUMS=`lsdir $SLOTOSDIR/slot | sort -n`
113 if [ $FLG_C -eq 0 ]; then
120 if [ $FLG -eq 1 ]; then
121 NUMS=`lsdir $SLOTOSDIR/slot | sort -n`