How to fully automate the FEKO Updater process on (possibly non-interactive) systems?
Answers
-
This how-to describes the required steps to configure the system to run the FEKO Updater automatically (periodically based on some schedule) on systems which might not have any interactive logins (e.g. pure compute nodes). Also this can be used on any system where this task should be automated without having any user to do the updates manually.
Introduction
The FEKO Updater comes in two options:
- graphical user interface
- commandline application
Both do the same task: They update the complete FEKO installation to the latest available state.
Regarding the possible configuration options and updating scenarios, please see the chapter 'The FEKO software updater' in the FEKO UserManual. For automation the commandline version is the tool of choice, as this can be instructed using the commandline options:
Syntax: feko_update OPTION Options: --check [[usr:pwd@]proxy[:port]] check if updates are available from the FEKO webpage (by default the system proxy is used, but a custom proxy server can be specified) --check --no-proxy same as above, but suppresses the use of a proxy (including the system proxy) --check-from check if updates are available from a local repository specified by --update [[usr:pwd@]proxy[:port]] update from the FEKO webpage and then install the updates (by default the system proxy is used, but a custom proxy server can be specified) --update --no-proxy same as above, but suppresses the use of a proxy (including the system proxy) --update-from update from a local repository specified by and then install the updates. --version print the version information and then exit
Windows
To automate the process under Windows, the integrated 'Scheduled Tasks' is going to be used.
Preparation:
The recommended way is to place the call to the FEKO Updater in a Windows Batch File which then is run by the task scheduler. The reasons behind this are:
- Easy to maintain: Only the batch file has to be modified, not the scheduled task itself
- File could be stored/maintained at a central location (e.g. network share) and used by many machines
- If having more than one installation of FEKO (e.g. concurrent versions) on the machine(s), all of them (or also only a subset) could be updated
Below are some sample batch files:
- Updating the latest (or only) installed version of FEKO:
@echo off set FEKO_UPDATE_LOGFILE=C:\TEMP\feko_updater.log echo ================ >> '%FEKO_UPDATE_LOGFILE%' echo Running FEKO update on machine %COMPUTERNAME% at %DATE% %TIME% >> '%FEKO_UPDATE_LOGFILE%' feko_update --update >> '%FEKO_UPDATE_LOGFILE%' 2>&1
Since the latest FEKO installation will be in the PATH, this will always work. - Updating all (concurrently) installed versions of FEKO:
@echo off set FEKO_UPDATE_LOGFILE=C:\TEMP\feko_updater.log set FEKO_INSTALL_DIR=%PROGRAMFILES%\FEKO echo ================ >> '%FEKO_UPDATE_LOGFILE%' echo Running FEKO update on machine %COMPUTERNAME% at %DATE% %TIME% >> '%FEKO_UPDATE_LOGFILE%' for /F 'usebackq tokens=*' %%f in (`dir /b '%FEKO_INSTALL_DIR%'`) do ( if exist '%FEKO_INSTALL_DIR%\%%f\feko_update' '%FEKO_INSTALL_DIR%\%%f\feko_update' --update >> '%FEKO_UPDATE_LOGFILE%' 2>&1 )
Please be sure to insert your correct location of the FEKO installation directory forFEKO_INSTALL_DIR
!
Adding the scheduled task:
- Windows XP:
- Open the 'Add Scheduled Task' wizard (START -> Control Panel -> Scheduled tasks -> Add Scheduled Task).
- Click 'Browse' and navigate to the batch file (as created in the above preparation step).
- Specify a name (e.g. 'Automatic FEKO updates') for this task and select the schedule (e.g. 'daily').
- Specify the detaild scheduling options.
- Specify the login credentials being used for executing this task.
Important: The user must have administrative rights for the FEKO updater to be able to update all files! - If you want to specify additional (more detailed) options, then check the 'Open advanced properties...' checkbox.
This will now add the FEKO Updater task to the list of scheduled tasks in Windows. You might want to try, if the task will execute as expected by running it manually now once (Right-click -> Run). The result schould be '0x0' for success.
- Windows Vista / Windows 7:
- Open the 'Create Basic Task' wizard (START -> Control Panel -> Administrative Tools -> Task Scheduler -> Create Basic Task...).
- Specify a name (e.g. 'Automatic FEKO updates') for this task.
- Select the trigger/schedule (e.g. 'daily') for this task.
- Specify the detailed scheduling options.
- Select 'Start a program'.
- Click 'Browse' and navigate to the batch file (as created in the above preparation step).
- Check the 'Open advanced properties...' checkbox.
- Specify a name (e.g. 'Automatic FEKO updates') for this task and select the schedule (e.g. 'daily').
- Specify the login credentials being used for executing this task by clicking on 'Change user or group', if required.
Important: The user must have administrative rights for the FEKO updater to be able to update all files!
This will now add the FEKO Updater task to the list of scheduled tasks in Windows. You might want to see if the task will execute as expected by running it manually now once (Right-click -> Run). The result should be '0x0' for success.
Linux
To automate the process under Linux/Unix, the CRONTAB will be used.
Preparation:
The recommended way is to place the call to the FEKO Updater in a Shell Script which then will be called from the CRONTAB. For the reasons, see above.
Below are some sample shell script files:
- Updating a single installed version of FEKO:
FEKO_UPDATE_LOGFILE=/tmp/feko_updater.log echo '================' >> $FEKO_UPDATE_LOGFILE host=`hostname` date=`date` echo 'Running FEKO update on machine $host at $date' >> $FEKO_UPDATE_LOGFILE if [ -f /opt/feko/6.0/bin/feko_update ] then . /opt/feko/6.0/bin/initfeko feko_update --update >> $FEKO_UPDATE_LOGFILE 2>&1 fi
The above example shows the default path for FEKO 6.0, a legacy FEKO installation - so please be sure to use your correct path. - Updating all (concurrently) installed versions of FEKO:
FEKO_UPDATE_LOGFILE=/tmp/feko_updater.log FEKO_INSTALL_DIR=/opt/feko echo '================' >> $FEKO_UPDATE_LOGFILE host=`hostname` date=`date` echo 'Running FEKO update on machine $host at $date' >> $FEKO_UPDATE_LOGFILE for f in `ls $FEKO_INSTALL_DIR | grep -v .backup` do if [ -f $FEKO_INSTALL_DIR/$f/bin/feko_update ] then . $FEKO_INSTALL_DIR/$f/bin/initfeko feko_update --update >> $FEKO_UPDATE_LOGFILE 2>&1 fi done
Please be sure to insert your correct location of the FEKO installation directory forFEKO_INSTALL_DIR
!
Adding the CRONTAB task:
In a shell run '
crontab -e
' and then add the call to the above created script with the desired schedule (see 'man crontab
' for details). A sample entry could be:####################################### # FEKO Update ####################################### # Run the FEKO updater every morning at 3:00 to check for new FEKO updates 0 3 * * * /root/update_feko_script.sh
After exiting the edit mode of CRONTAB the task is scheduled and will be run.
0