-----Original message-----
From:   Catherine ORTEU <[email protected]>
Sent:   Tue 24-09-2013 12:20
Subject:        [SunRay-Users] How to force a power cycle of a DTU from the 
server
To:     [email protected]; 
> Hello everybody,
> 
> Is there any command to perform a simple power cycle of a DTU from a
> linux server (something equivalent to CTRL-Moon) ?
> 
> -- 
> Catherine ORTEU - Ingenieur Systeme
> Ecole des Mines d'Albi-Carmaux  (http://www.mines-albi.fr)
> 81013 ALBI CT Cedex 09 - Tel : 05 63 49 32 20
> 
> _______________________________________________
> SunRay-Users mailing list
> [email protected]
> http://www.filibeto.org/mailman/listinfo/sunray-users
> 


Hello Catherine,

if you know the token of the associated session, you can use:

utload -r -t $TOKEN

I use the following script to get rid of hanging sessions.

It's also useful when a server in a failover group had to be rebooted and all 
idle login sessions are on the remaining servers. After rebooting the server 
just run the script on the other server in the FOG to make sure idle login 
sessions move to the freshly rebooted machine.


#################################################################################
#!/bin/bash
# kill all sessins, that do not belong to a user
# kill all Xnewt servers, that do not belong to a session

# set PATH
PATH=$PATH:/opt/SUNWut/sbin:/opt/SUNWut/bin:/opt/SUNWut/lib

# get sessions with NO "Unix ID"
utsession -p -x \
| grep uid=NULL \
| cut -d ";" -f 1 \ 
| cut -d "=" -f 2 \ 
| while read TOKEN
do
    # reboot DTU
    utload -r -t $TOKEN
    echo "rebooting DTU $TOKEN"
    # kill session
    echo "killing session $TOKEN"
    utsession -k -t $TOKEN
done


# get running Xnewt prcesses
ps ax -o pid,command \
| grep -v "grep" \
| grep -e "Xnewt :[0 9]*" \
| sed 's/ //' \
| cut -d " " -f 1,3 \
| sed 's/ //' \
| while read PROCESS
do
    DISP=$(echo $PROCESS | cut -d ":" -f 1)
    PROC=$(echo $PROCESS | cut -d ":" -f 2)
    if [ $(utsession -p -x |  cut -d ";" -f 5 |  cut -d "=" -f 2 | grep $DISP) ]
    then
       echo "killing hanging Xnewt with PID: $PROC"
       echo "kill -9 $PROC"
    fi  
done
#####################################################################################


cu

Carsten
_______________________________________________
SunRay-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/sunray-users

Reply via email to