Why you can't simply add the execution to the FreeNAS GUI Cron Jobs?Hello,
I wrote a short script and tried few things:
- adding a cronjob to launch the sript at startup (it's not working, since FreeNAS will overwrite cron file at startup based upon FreeNAS default and settings done using WebUI)
- adding the script to rc.d (it's not working, since FreeNAS will overwrite rc.d file at startup based upon FreeNAS default and settings done using WebUI)
- adding script to cron or rc.d in a jail running on the FreeNAS (since my temperature monitoring files are located at /root/scripts and I don't want jail to access this path, it's not good either or I should just move everything)
Best way to make the script working would be that FreeNAS WebUI Cron Jobs can support @Reboot directive, so I created a ticket for that in the FreeNAS issue tracker: FreeNAS Cron Jobs don't support @reboot directive .
If this feature is fixed, using @Reboot in WebUI will allow users to easily launch scripts at startup. Maybe it will be OK for next update.
This sounds like a job for an init script task:the python server must be launched and stay online
cd /root/scripts/ && python -m http.server 8014
And I created the ticket exactly just because the Init script don't work for such commands...This cannot be fixed due to the way FreeNAS boot works as an appliance. This functionality can be achieved using init tasks as described in the handbook.
iocage list jexec "your-jail-number" tcsh
pkg install apache24 sysrc apache24_enable=yes mkdir /usr/local/www/apache24/data/temp
Source /mnt/pool-name/dataset-name/temperature-monitoring Destination /mnt/pooll-name/iocage/jails/Apache/root/usr/local/www/apache24/data/temp