This will of course depend on your PLC, but assuming scp is available, you can try the following on RUT955. Connect to RUT955 via CLI/SSH and execute the following commands:
- opkg update
- opkg install sshpass
With this package, you will be able to pass your password via SCP command, which will be used to download the file.
Next, to download an archive, you can use the following command on RUT955 to download a file from PLC:
- sshpass -p <PLC_ROOT_PASSWORD> scp <PLC_ROOT/USERNAME>@<PLC_IP_ADDRESS:<FILE_PATH_ON_PLC> <FILE_PATH_ON_RUT955>
- sshpass -p admin01 scp firstname.lastname@example.org:/etc/test_archive /etc
This command will download the file test_archive from PLC to the '/etc' folder in RUT955. In this case, we have authorized via username 'root' and password 'admin01'. These should be your PLC credentials.
If you want to update the file every 24 hours, you can put this command into a script and execute it every 24 hours via crontab.
To create a script, use the following commands:
- touch /etc/download_archive.sh
- chmod +x /etc/download_archive.sh
- vi /etc/download_archive.sh
You will open a text editor. Press 'i' to start editing. Paste the following (change according to your needs):
sshpass -p admin01 scp email@example.com:/etc/test_archive /etc
Save the script by pressing 'esc' button, typing ':wq' and pressing 'enter'. The script should be created.
To add these commands to crontab, execute the following command:
It will open in text editor. Press 'i' to start editing. To run the script everyday at midnight (every 24hours) add the following:
- 0 0 * * * sh /etc/download_archive.sh >/dev/null 2>&1
Save your changes by pressing 'esc' button, typing ':wq' and pressing 'enter'.
This will execute the script and download the file every day at midnight.
You can change the times if you want. More information about crontab can be found here. You can also use crontab generator like the one here.