Changeset 1097


Ignore:
Timestamp:
Jun 9, 2008, 2:18:35 PM (10 years ago)
Author:
jrollins
Message:

added lockfile support to close #484980. still needs testing.

Location:
trunk/cereal
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/cereal/debian/cereal.postinst

    r1038 r1097  
    1212fi
    1313
    14 # add the 'down' file to all stopped sessions
     14# apply some needed upgrades to existing sessions
    1515for session in $(cereal list | cut -d ' ' -f 2) ; do
    16     # check if the session is stopped
     16
     17    # add the 'down' file to all stopped sessions
    1718    if cereal list "$session" | grep -q '^-' ; then
    18         # add the down file
    1919        touch /var/lib/cereal/sessions/"$session"/down
    2020    fi
     21
     22    # make sure all sessions have the finish script
     23    # added for version 0.22
     24    ln -sf /usr/share/cereal/finish /var/lib/cereal/sessions/"$session"/finish
     25
    2126done
    2227
  • trunk/cereal/debian/changelog

    r1096 r1097  
    44  * properly check group ownership for symlinked ttys (Closes: #484979)
    55    (thanks Marc Haber for patch).
    6 
    7  -- Jameson Graef Rollins <jrollins@phys.columbia.edu>  Sun, 08 Jun 2008 12:38:25 -0400
     6  * handle locking of the serial device using lockfile (Closes: #484980)
     7 
     8 -- Jameson Graef Rollins <jrollins@phys.columbia.edu>  Mon, 09 Jun 2008 14:10:57 -0400
    89
    910cereal (0.21-1) unstable; urgency=low
  • trunk/cereal/fs/usr/sbin/cereal-admin

    r1096 r1097  
    6969    mkdir -p "$SESSIONDIR/$SESSION"
    7070    ln -s "$SHAREDIR/mainrun" "$SESSIONDIR/$SESSION/run"
     71    ln -s "$SHAREDIR/finish" "$SESSIONDIR/$SESSION/finish"
    7172    touch "$SESSIONDIR/$SESSION/down"
    7273
  • trunk/cereal/fs/usr/share/cereal/common

    r1040 r1097  
    226226
    227227    echo "starting screen session..."
     228    LOCKFILE=/var/lock/LCK..${TTY##/dev/}
     229    if ! lockfile -r0 "$LOCKFILE" ; then
     230        exit $?
     231    fi
     232    chmod u+w "$LOCKFILE"
     233    printf '%9s\n' $$ >> "$LOCKFILE"
    228234    exec chpst -u "$USER:$GROUP" /usr/bin/screen -D -m -L -c "$SCREENRC" -s /bin/false -S "cereal:$SESSION" -t "$SESSION" "$TTY" "$BAUD"
    229235}
     236
     237# function called by the session service finish script to remove the
     238# serial device lockfile
     239# takes no arguments, since it is called with a "chpst -e"
     240remove_lock() {
     241    LOCKFILE=/var/lock/LCK..${TTY##/dev/}
     242    rm -r "$LOCKFILE"
     243}
Note: See TracChangeset for help on using the changeset viewer.