check wether we are already running
This commit is contained in:
14
backup.sh
14
backup.sh
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
source functions.sh
|
source functions.sh
|
||||||
|
|
||||||
|
pidfile=/var/run/backup_script
|
||||||
|
|
||||||
|
if [ -f $pidfile ] ; then
|
||||||
|
pid=$(cat $pidfile)
|
||||||
|
if [ -d /proc/$pid ] ; then
|
||||||
|
myerror 42 "$pid already running"
|
||||||
|
else
|
||||||
|
rm -f $pidfile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $$ > $pidfile
|
||||||
|
|
||||||
function listBackups {
|
function listBackups {
|
||||||
ls -lrt $1
|
ls -lrt $1
|
||||||
exit 0
|
exit 0
|
||||||
@@ -37,3 +50,4 @@ for dir in "$@" ; do
|
|||||||
echo cp -a $dir $backupdir
|
echo cp -a $dir $backupdir
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm -f $pidfile
|
||||||
|
|||||||
Reference in New Issue
Block a user