weixin_39647787
2020-12-28 08:20 阅读 0

Custom Cron Jobs via WebGUI

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.

该提问来源于开源项目:rockstor/rockstor-core

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

7条回答 默认 最新

  • weixin_39534208 weixin_39534208 2020-12-28 08:20

    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.

    点赞 评论 复制链接分享
  • weixin_39647787 weixin_39647787 2020-12-28 08:20

    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...

    点赞 评论 复制链接分享
  • weixin_39534208 weixin_39534208 2020-12-28 08:20

    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.

    点赞 评论 复制链接分享
  • weixin_39534208 weixin_39534208 2020-12-28 08:20

    Linking to a related issue for further context: "Schedule power down/up of the system" #735

    点赞 评论 复制链接分享
  • weixin_39575054 weixin_39575054 2020-12-28 08:20

    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 and : 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

    点赞 评论 复制链接分享
  • weixin_39575054 weixin_39575054 2020-12-28 08:20

    Notes on custom scheduled tasks : - idea to add some standard tasks: reboot/shutdown/power down-up on #735 ; rsync task - system/osi 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 on

    Mirko

    点赞 评论 复制链接分享
  • weixin_39534208 weixin_39534208 2020-12-28 08:20

    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

    点赞 评论 复制链接分享

相关推荐