Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon5.gif   any way to undelete entries?, posted by Mark Bergman on Thu Feb 21 23:23:19 2013 
    icon2.gif   Re: any way to undelete entries?, posted by Stefan Ritt on Fri Feb 22 08:19:27 2013 
    icon2.gif   Re: any way to undelete entries?, posted by Andreas Luedeke on Fri Feb 22 10:58:18 2013 elog_backup_dailyelog_backup_hourlyexclude-logbooks
Message ID: 67454     Entry time: Fri Feb 22 10:58:18 2013     In reply to: 67452
Icon: Reply  Author: Andreas Luedeke  Author Email: andreas.luedeke@psi.ch 
Category: Question  OS: Linux  ELOG Version: 2.92 
Subject: Re: any way to undelete entries? 

Mark Bergman wrote:

 Is there any way within eLog to undelete entries?

 I wrote to scripts to backup the logbook files:

  • elog_backup_daily creates a tar file of all new entries of the last 25 hours and keeps these backups for 90 days
  • elog_backup_hourly creates a tar file of the entries of the last 65 minutes and keeks these backups for one week
  • exclude-logbooks specifies which files not to backup

This allows you at least to recover deleted entries by hand as an administrator.

 
Detect language » English
 
 
Detect language » English
 
 
Detect language » English
 
 
Detect language » English
 
 
Detect language » English
 
Attachment 1: elog_backup_daily  754 Bytes  | Hide | Hide all
#!/bin/sh
# source file directory
srcd=/usr/local/elog/

# backup all files newer than 25 hours
date=$(date -d "-25hours" "+%Y%m%d %H:%M")
# backup file directory
tard=/logbooks_backup
# backup tar file name
tarf=$tard/$(date +%Y%m%d_%a.tar)
# do not backup files that match patterns in this file
excf=/usr/local/elog/utilities/exclude-logbooks
# create backup
cd $srcd
tar --ignore-case -X $excf --newer "$date" -cf $tarf . logbooks/*

# copy passwd.txt
if [ "$(date +%u)" -eq 1 ]
then
	passwd=$tard/passwd_$(date +%Y%m%d_%a.txt)
	cp $srcd/passwd.txt $passwd
	gzip -9 $passwd
fi
# delete all backups older than 90 days
find $tard -mtime +90 -name "*_???.tar"           -exec rm -f {} +
find $tard -mtime +90 -name "passwd_*_???.txt.gz" -exec rm -f {} +
Attachment 2: elog_backup_hourly  447 Bytes  | Hide | Hide all
#!/bin/sh
# source file directory
srcd=/usr/local/elog/

# backup all files newer than 25 hours
date=$(date -d "-65minutes" "+%Y%m%d %H:%M")
# backup file directory
tard=/logbooks_backup
# backup tar file name
tarf=$tard/$(date +%a%H%M.tar)
rm -f $tarf
# do not backup files that match patterns in this file
excf=/usr/local/elog/utilities/exclude-logbooks
# create backup
cd $srcd
tar --ignore-case -X $excf --newer "$date" -cf $tarf . logbooks/*
Attachment 3: exclude-logbooks  123 Bytes  | Hide | Hide all
*.png.png
*.gif.png
*.jpg.png
*.pdf.png
oldLogbooks/*
logbooks/elog.log
passwd.txt
ssl/*
logbooks/Backup/*
logbooks/old/*

ELOG V3.1.5-fe60aaf