clean up when exiting
This commit is contained in:
@@ -4,6 +4,11 @@ source functions.sh
|
||||
|
||||
pidfile=/var/run/backup_script
|
||||
|
||||
function cleanup {
|
||||
echo "bye bye"
|
||||
test -f $pidfile && rm -f $pidfile
|
||||
}
|
||||
|
||||
if [ -f $pidfile ] ; then
|
||||
pid=$(cat $pidfile)
|
||||
if [ -d /proc/$pid ] ; then
|
||||
@@ -48,6 +53,6 @@ mkdir -p $backupdir || myerror 2 "impossible de créer $backupdir"
|
||||
for dir in "$@" ; do
|
||||
test -d $dir || { echo $dir dont exist ; continue ; }
|
||||
echo cp -a $dir $backupdir
|
||||
sleep 600
|
||||
done
|
||||
|
||||
rm -f $pidfile
|
||||
|
||||
Reference in New Issue
Block a user