Automation of processes - using scripts in practice
This chapter uses a sample to describe how scripts can be used in conjunction with the TwinCAT/BSD installer. Scripts are extremely useful for automating various tasks related to TwinCAT/BSD systems and the TwinCAT/BSD installer. They can be used to create backups, restore backups, configure the system, perform automatic installations and much more.
This chapter is limited to a scene in which a backup is created automatically from a TwinCAT/BSD system with the aid of a TwinCAT/BSD installer.
Other scenarios for the use of scripts are conceivable. As a reminder, the following table describes in which directory the scripts for each task must be placed in order to function properly.
Proceed as follows:
- 1. Copy the scripts
auto_backup.sh
andreboot.sh
from the directory \INSTALLER\autorun_samples\auto_backup to the directory \INSTALLER\autorun. - 2. Insert the USB stick prepared in this way into an industrial PC.
- 3. Restart the industrial PC and press [F7] to enter the boot menu. In the boot menu, select the USB stick you want to boot from.
- 4. The TwinCAT/BSD installer is started and then a backup is created automatically. A backup is generated with a file name from the host name of the system and the current timestamp and stored in the \INSTALLER directory. Interaction with the graphical user interface is not required.
- 5. In the last step the industrial PC is restarted after the backup with the help of the script
reboot.sh
.
- The backup is saved on the USB stick in the directory \INSTALLER. If a Beckhoff stick is used for this task, it is not necessary to call up the boot menu with [F7]. In the BIOS, Beckhoff USB sticks are set up as the first boot medium by default and are recognized automatically. When a Beckhoff USB stick is inserted, the USB stick is therefore booted directly.