Skip to content

Commit

Permalink
Add a lock file checking when rTorrent starts up
Browse files Browse the repository at this point in the history
Signed-off-by: kfei <[email protected]>
  • Loading branch information
kfei committed Dec 4, 2014
1 parent 57dfe4f commit d772d8a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions rootfs/etc/s6/rtorrent/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,21 @@ mkdir -p /rtorrent/{downloads,watch,.session,rutorrent/user-profiles}
# Change permission to ruTorrent's webserver user
chown -R www-data:www-data /rtorrent

# Checking the lock
if [ -f /rtorrent/.session/rtorrent.lock ]; then
echo
prompt="The rTorrent session lock is detected, it can be a result of an \n"
prompt="${prompt}unexpected exit or other running rTorrent instance.\n"
echo -e ${prompt}
prompt="Remove lock and continue anyway? [y/N] "
read -r -p "${prompt}" response
response=${response,,}
if [[ $response =~ ^(yes|y)$ ]]; then
rm -f /rtorrent/.session/rtorrent.lock
else
s6-svscanctl -t /etc/s6
fi
fi

# Turn to rTorrent
exec rtorrent

0 comments on commit d772d8a

Please sign in to comment.