Feature #1088
Automatically update parameter file if parameter changed
| Status: | Closed | Start date: | 01/17/2014 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned To: | % Done: | 100% | ||
| Category: | - | |||
| Target version: | 00-07-00 | |||
| Duration: |
Description
Several users reported problems after an update of ctools related to obsolete parameter files in the pfiles directory (see for example #1087).
A mechanism should be implemented that automatically updates the pfiles if a new version becomes available. This can only be done upon using ctools, as each user has his own pfiles directory which cannot be accessed during installation. One solution would be that the file modification times of the local file in pfiles is compared with the file in syspfiles. If syspfiles is newer, an update is done.
Recurrence
No recurrence.
Related issues
Associated revisions
Update pfiles if syspfiles are newer (fixes #1088)
History
#1
Updated by Knödlseder Jürgen almost 13 years ago
Not sure anymore if this should be done over the modification time, as in GAMMALIB no explicit reference should be made to ctools. We may do this using the ctools configuration script, looping over all files in PFILES and replacing them if the version in SYSPFILES is newer.
#2
Updated by Knödlseder Jürgen almost 13 years ago
Problem: modification time is accessed in a shell on Unix using
stat -c "%Y" file.par
while on Mac OS X the command is
stat -f "%m" file.par
#3
Updated by Knödlseder Jürgen almost 13 years ago
The following seems to work on all systems:
if test cssens.par -nt cspull.par
then
echo "cssens.par newer"
else
echo "cspull.par newer"
fi
#4
Updated by Knödlseder Jürgen almost 13 years ago
The following seems to do the job:
local_pfiles=$HOME/pfiles
sys_pfiles=$GAMMALIB/syspfiles
for filename in $local_pfiles/*.par
do
parfile=`basename $filename`
sys_parfile=$sys_pfiles/$parfile
if [ -e $sys_parfile ]
then
if test $sys_parfile -nt $filename
then
cp -f $sys_parfile $filename
fi
fi
done
#5
Updated by Knödlseder Jürgen almost 13 years ago
- Status changed from New to Feedback
- Assigned To set to Knödlseder Jürgen
- Target version set to 00-07-00
- % Done changed from 0 to 100
The code has been implemented in the GammaLib and ctools setup scripts. Should no longer be an issue.
#6
Updated by Knödlseder Jürgen almost 13 years ago
- Status changed from Feedback to Closed