Open Stoney49th opened 9 years ago
@Stoney49th Yes this is a great Idea. Adding shutdown as a "task type" to the existing System - Scheduled Tasks is on the cards I believe but not yet actually under way. Of course pull requests are always welcome :) Presumably your "auto-wakeup" idea is for waking up other machines via WOL, if not how would this be implemented as I don't think the UEFI programming interface is there yet on this. Please correct me if I am wrong here though as this would be great.
@phillxnet Reboot might also be a good candidate, especially for remote systems with a userbase - so the system can carry out ordered reboots at weekends or at night to boot a new kernel for instance. Currently (I'm a typical, advanced home nas/server user) I'm running openmediavault, where some guys wrote "plugins" aka shellscripts which put the machine in a defined sleep or shutdown state (aka. pm-suspend/hibernate/etc, or shutdown -h) once certain conditions are satisfied. The wakeup of the machine is done via a second script, programming the on-board rtc of the motherboard (no UEFI tinkering required). The combination works great on modern boards (and old ones too!), if the UEFI/BIOS supports the RTC wakeup option (most do). A "remote host WOL" would also be a cool thing :)
I'm super busy right atm (one of the reasons why rockstor is still a vm test :( ), but I'll have a look at the codebase. My main language is c (fighting with embedded stuff), but sometimes I use python, java or other languages to automate stuff, maybe I can contribute something over the holidays...
@Stoney49th That's great news, I knew of the RTC wakeup in a good many more modern machines but didn't know there was a reliable / standard way to program it. Great. I've used the manual entry multiple time myself to have machines wake up early in the morning say and it's a really useful feature so having this accessible in the Rockstor interface would be a major win. Anything you could contributions would doubtless be much appreciated and thanks for the pointers and ideas. This would be a dandy addition to the "task type".
Thanks for updating / correcting me on this one; I would really like the RTC wakup feature in Rockstor myself.
Linking to a related issue for further context: "Schedule power down/up of the system" #735
Hi all, starting from 8abb5d4 working on Custom Scheduled Tasks :smiley: I know it's not a Looney Bean issue, but I think it's an important one too
First reflection and request for comments @phillxnet and @schakrava :
snapshots and scrubs scripts are pure python called via cron so we wait for them to end, but custom scheduled tasks are user scripts to be called and we have to decide if to wait their ending ( popen.wait()
) and provide some tracking (start_time, end_time) or just detach them with popen
without waiting for end
My opinion: popen.wait() can provide a start time / end time for logging, but except for that it's a little risky (bad user script / long time script will have us to wait ), so I would go with a detached process
Flyer
Notes on custom scheduled tasks :
run_command()
requires an additional if statement over stdout,stderr,stdin: usually we have subprocess.PIPE(s)
and we communicate, so we wait till child process ends, but with longer tasks (ex. rsync) or unsafe (code errors/etc) users custom tasks we can have deadlocks, so having them with None - run child process and we go onMirko
Please update the following forum thread with this issues resolution as interest was expressed in the ability to schedule user scripts via the Web-UI: https://forum.rockstor.com/t/feature-request-add-scheduled-task-type-for-periodic-rock-on-restart-in-webui/3960/10
Please also update the following forum thread with this issue resolution re scheduling custom user scripts: https://forum.rockstor.com/t/scheduled-task-question/4731
Please add the possibility to automate certain things by adding the possibility to configure user scripts in the cron config dialogs in the WebGUI. With custom user script support, one could easily add stuff like auto-wakeup, auto-shutdown or ddns services for home use, which would be a great benefit. The scripts can then be shared by users, adding value to the project until some of the features are implemented in the Webgui.