autorun package V1.10 for Synology NAS
Executes a script when connecting external storages (USB / eSATA) on a Synology NAS with DSM 7.x. Typical use is to copy or backup some files. In Synologies Task Scheduler there is the possibility to create triggered tasks. But for the trigger event there are only Boot-up and Shutdown available. There are no USB events like 'external storage mounted' available. This deficit is compensated by this tool.
During the package installation to your NAS you have to enter the name of the shell script, which should be executed at the trigger event 'external storage device mounted'. The script can be located either in the root folder of the external device or internal on your NAS. Optionally you can exject that external device after your script is finished. A security option is to register the SHA256 checksum of the executed script and to restrict further executions to scripts matching the previously registered checksums.
License
Disclaimer and Issue Tracker
You are using everything here at your own risk. For issues please use the issue tracker with German or English language
Build and Installation
- If you want to build the package yourself from the source: Download all files. Set the file 'build' to executable and run that script to generate the *.spk file. No toolkit needed.
- Or download the *.spk file from "Releases", "Assets" to your computer.
Then use "Manual Install" in the Package Center.
Third Party packages are restricted by Synology in DSM 7. Since autorun does require root permission to perform its job an additional manual step is required after the installation before a "Run" can be done successfully.
SSH to your NAS (as an admin user) and execute the following command:
sudo cp /var/packages/autorun/conf/privilege.root /var/packages/autorun/conf/privilege
Alternative to SSH: Go to Control Panel => Task Scheduler => Create => Scheduled Task => User-defined Script. In the "General" tab set any task name, select 'root' as user. In the "Task Settings" tab enter
cp /var/packages/autorun/conf/privilege.root /var/packages/autorun/conf/privilege
as "Run command". Finish it with OK. When you are requested to execute that command now during package installation, then go to the task scheduler, select that task and "Run" it.
Under https://www.cphub.net/ in the Package Center there are elder versions for elder DSM versions available:
- DSM 7: 1.8
- DSM 6: 1.7
- DSM 5: 1.6
- elder: 1.3
Credits and References
- Thanks to Jan Reidemeister for his Version 1.8 and his License
- Thanks to the Synology Forum Thread about that autorun package
- Thanks to toafez Tommes and his Demo Package
- Thanks to geimist Stephan Geisler and hit tip to use the DeepL API for translations to other languages.