Only permit one instance of GParted to execute at a time

Only one partition editing tool should be in use at any one point
in time.  If more than one is in use concurrently, then data loss
might occur through operations on common partitions or partition
tables.  As such, prevent multiple copies of GParted from running
at the same time.
This commit is contained in:
Curtis Gedak 2013-06-11 13:09:18 -06:00 committed by Mike Fleetwood
parent 4c109df9b5
commit 4c9c70d697
1 changed files with 14 additions and 3 deletions

View File

@ -3,9 +3,11 @@
# Purpose: Perform appropriate startup of GParted executable gpartedbin.
#
# The purpose of these startup methods is to prevent
# devices from being automounted.
# File system problems can occur if devices are mounted
# prior to the completion of GParted's operations.
# devices from being automounted, and to ensure only one
# instance of GParted is running. File system problems can
# occur if devices are mounted prior to the completion of
# GParted's operations, or if multiple partition editing
# tools are in use concurrently.
#
# Copyright (C) 2008, 2009, 2010, 2013 Curtis Gedak
#
@ -25,6 +27,15 @@
# along with GParted. If not, see <http://www.gnu.org/licenses/>.
#
#
# Only permit one instance of GParted to execute at a time
#
if test "z`ps -e | grep gpartedbin`" != "z"; then
echo "The process gpartedbin is already running."
echo "Only one gpartedbin process is permitted."
exit 1
fi
#
# Search PATH to determine if systemctl program can be found
# and if appropriate daemon is running.