Changeset 652


Ignore:
Timestamp:
Oct 13, 2007 10:07:41 AM (6 years ago)
Author:
jrollins
Message:

cereal: couple of minor tweaks/cleanup.

Location:
trunk/cereal/fs/usr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/cereal/fs/usr/sbin/cereal-admin

    r651 r652  
    106106# start_check 
    107107start_check() { 
    108     chpst -u "$USER:$GROUP" bash -c "test -r $TTY && test -w $TTY" 
     108    check_tty_rw "$USER" "$GROUP" "$TTY" 
    109109} 
    110110export -f start_check 
     
    134134        elif is_linked "$SESSION" ; then 
    135135            error "Session '$SESSION' is already running." 1 
     136        elif [ ! -w "$SERVICEDIR" ] ; then 
     137            error "You do not have permission to start session '$SESSION'." 2 
    136138        elif ! chpst -e "$SESSIONDIR/$SESSION/env/" sh -c start_check ; then 
    137             error "Session '$SESSION' not properly configured, or you do not have permission to start session." 2 
     139            error "Session '$SESSION' not properly configured." 2 
    138140        else 
    139141            if start_session "$SESSION" ; then 
     
    171173        elif ! is_linked "$SESSION" ; then 
    172174            error "Session '$SESSION' not linked." 1 
     175        elif ! is_controllable "$SESSION" ; then 
     176            error "You do not have permission to stop session '$SESSION'." 2 
    173177        else 
    174178            if stop_session "$SESSION" ; then 
     
    206210        if ! is_session "$SESSION" ; then 
    207211            echo "Session '$SESSION' not found." 
    208             continue 
    209212        elif ! is_linked "$SESSION" ; then 
    210213            start "$SESSION" 
     214        elif ! is_controllable "$SESSION" ; then 
     215            error "You do not have permission to restart session '$SESSION'." 2 
    211216        else 
    212217            if restart_session "$SESSION" ; then 
  • trunk/cereal/fs/usr/share/cereal/common

    r651 r652  
    104104export -f is_running 
    105105 
     106# check if user can control session 
     107# is_controllable SESSION 
     108is_controllable() { 
     109    sv status "$SERVICE.$1" > /dev/null 
     110} 
     111export -f is_controllable 
     112 
    106113# can_attach SESSION [USER] 
    107114can_attach() { 
    108     USER=${2:-"$USER"} 
     115    local USER=${2:-"$USER"} 
    109116    [ "$USER" = $(cat "$SESSIONDIR/$1/env/USER") ] 
    110117} 
     
    120127    local LOGUSER=$(cat "$SESSIONDIR/$1/env/LOGUSER") 
    121128    local LOGGROUP=$(cat "$SESSIONDIR/$1/env/LOGGROUP") 
    122     USER=${2:-"$USER"} 
     129    local USER=${2:-"$USER"} 
    123130    [ "$USER" = "$LOGUSER" ] || in_group "$USER" "$LOGGROUP" || [ $(id -u "$USER") = '0' ] 
    124131} 
  • trunk/cereal/fs/usr/share/man/man8/cereal-admin.8

    r651 r652  
    6464Logs are handled by 
    6565.BR svlogd. 
    66 For information on how to control session log handling, please see the 
    67 svlogd man page, or the howto included with the documentation included 
    68 with this package. 
     66For information on how to control session log handling, please see 
     67svlogd(8), or the howto included with the documentation included with 
     68this package. 
    6969.PD 
    7070.SH FILES 
Note: See TracChangeset for help on using the changeset viewer.