New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule power down/up of the system #735

Closed
schakrava opened this Issue Jul 14, 2015 · 21 comments

Comments

Projects
None yet
5 participants
@schakrava
Member

schakrava commented Jul 14, 2015

feature request from the forum thread: http://forum.rockstor.com/t/features-i-would-like-in-rockstor/210

relevant section:
You can also power the NAS down and up again on a schedule, but I'm not sure this could be implemented on RockStor, due to lack of control over how to power the sytem up again.

@schakrava schakrava added the Feature label Jul 14, 2015

@schakrava schakrava added this to the Yosemite milestone Jul 14, 2015

@phillxnet

This comment has been minimized.

Show comment
Hide comment
@phillxnet

phillxnet Jul 15, 2015

Member

@schakrava A "Task type" profile to go along with the existing scrub and snapshot profiles could do a poweroff command at a configurable time. Users can always configure their BIOS to do timed power on with many systems these days until we get a proper UEFI interface option to do timed power-ups.

Member

phillxnet commented Jul 15, 2015

@schakrava A "Task type" profile to go along with the existing scrub and snapshot profiles could do a poweroff command at a configurable time. Users can always configure their BIOS to do timed power on with many systems these days until we get a proper UEFI interface option to do timed power-ups.

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Jul 17, 2016

Dive into tasks land for #735 #1036 #1306
Initial commit for custome scheduled tasks feature on Rockstor

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Jul 19, 2016

Dive into tasks land for #735 #1036 #1306
Initial commit for custome scheduled tasks feature on Rockstor

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Sep 30, 2016

Dive into tasks land for #735 #1036 #1306
Initial commit for custome scheduled tasks feature on Rockstor

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Oct 2, 2016

Dive into tasks land for #735 #1036 #1306
Initial commit for custome scheduled tasks feature on Rockstor

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Oct 7, 2016

Dive into tasks land for #735 #1036 #1306
Initial commit for custome scheduled tasks feature on Rockstor

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Nov 15, 2016

Dive into tasks land for #735 #1036 #1306
Initial commit for custome scheduled tasks feature on Rockstor
@phillxnet

This comment has been minimized.

Show comment
Hide comment
@phillxnet

phillxnet Feb 9, 2017

Member

Noting @MFlyer supplied link to acpi / RTC info for scheduled wake-up from the following forum thread:
https://www.mythtv.org/wiki/ACPI_Wakeup
please update the following forum thread with the resolution of this issue:
https://forum.rockstor.com/t/power-management-auto-power-off-and-on/2815/4

Linking back to related issue #1036 which also has some info on ACPI / RTC wake up programming.

Member

phillxnet commented Feb 9, 2017

Noting @MFlyer supplied link to acpi / RTC info for scheduled wake-up from the following forum thread:
https://www.mythtv.org/wiki/ACPI_Wakeup
please update the following forum thread with the resolution of this issue:
https://forum.rockstor.com/t/power-management-auto-power-off-and-on/2815/4

Linking back to related issue #1036 which also has some info on ACPI / RTC wake up programming.

@MFlyer

This comment has been minimized.

Show comment
Hide comment
Member

MFlyer commented Feb 10, 2017

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 10, 2017

Member

Having code on this like a separate/test/base PR for #1036

Member

MFlyer commented Feb 10, 2017

Having code on this like a separate/test/base PR for #1036

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 15, 2017

Member

Cross ref to #1306

Member

MFlyer commented Feb 15, 2017

Cross ref to #1306

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 15, 2017

Member

@schakrava @phillxnet
Updates:
successfully scheduled a reboot or shutdown task and tested it, currently missing:

  • task editing funcs
  • custom shutdown options to allow wake on rtc
  • live wake rtc tester (inform user about rtc avail or not and suggest a test to try shutdown + wake on rtc)
  • WebUI helpers to alert connected users on incoming shutdown/reboot

Mirko

Member

MFlyer commented Feb 15, 2017

@schakrava @phillxnet
Updates:
successfully scheduled a reboot or shutdown task and tested it, currently missing:

  • task editing funcs
  • custom shutdown options to allow wake on rtc
  • live wake rtc tester (inform user about rtc avail or not and suggest a test to try shutdown + wake on rtc)
  • WebUI helpers to alert connected users on incoming shutdown/reboot

Mirko

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 16, 2017

#735 #1306 adding init commit, defining reboot task type
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 16, 2017

System/osi reboot and shutdown refactoring
Refs to #735 and #1306 - reboot and shutdown funcs already used
when performing those action via WebUI. Scheduled reboots/shutdowns
will have a 2 min delay (shutdown now is instead 1 min) to allow
users to stop system shutdown too

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 16, 2017

Reboot and Shutdown tasks - adding url dispatcher and view params
Refs to #735 and #1306 - Url Dispatcher updated to handle new
reboot/shutdown delay param, same done over commands view
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 19, 2017

RTC System Wake up custom fields
Refs to #735 #1306 - Adding rtc wake up hour and minute fields to
shutdown template plus auto toggle on rtc wake up checkbox

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 19, 2017

Member

Asking @rockstor/developers, @schakrava and users (@maxhq , @magicalyak, @daniel-illi, @sfranzen, @chrstphrchvz, @PhilippeAB, @tomtom13 and others) feedbacks:

Can you shell check this?
journalctl | grep rtc

On my dev env got an S4 support, so no available rtc wake up after system shutdown, but wake up from suspend wyth systemctl suspend(ACPI reference)
Probably 99% env support S4 only, so we can grant a suspend+wake up and not shutdown + wake up

Member

MFlyer commented Feb 19, 2017

Asking @rockstor/developers, @schakrava and users (@maxhq , @magicalyak, @daniel-illi, @sfranzen, @chrstphrchvz, @PhilippeAB, @tomtom13 and others) feedbacks:

Can you shell check this?
journalctl | grep rtc

On my dev env got an S4 support, so no available rtc wake up after system shutdown, but wake up from suspend wyth systemctl suspend(ACPI reference)
Probably 99% env support S4 only, so we can grant a suspend+wake up and not shutdown + wake up

@phillxnet

This comment has been minimized.

Show comment
Hide comment
@phillxnet

phillxnet Feb 19, 2017

Member

@MFlyer OK, on my ASUS N3700-ITX board I get:

journalctl | grep rtc
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: RTC can wake from S4
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: alarms up to one month, y3k, 242 bytes nvram
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: setting system clock to 2017-02-19 18:50:39 UTC (1487530239)

From memory isn't S4 essentially off anyway, S3 is regular suspend. I.e when bios set to have WOL doesn't that mean that off is S4 level and no deeper.
This motherboard is very likely to have wake on RTC, even from off, ie power down not just suspend.

Also from a NUC I have I get the following:

Feb 19 08:46:40 ytagit kernel: [    1.693588] rtc_cmos 00:05: RTC can wake from S4
Feb 19 08:46:40 ytagit kernel: [    1.693705] rtc_cmos 00:05: rtc core: registered rtc_cmos as rtc0
Feb 19 08:46:40 ytagit kernel: [    1.693734] rtc_cmos 00:05: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
Feb 19 08:46:40 ytagit kernel: [    1.708649] rtc_cmos 00:05: setting system clock to 2017-02-19 08:46:36 UTC (1487493996)

And this device wakes itself every morning via bios settings after shutting itself down via the following cron job every night:

# power off at 30 mins past midnight every day
30 0 * * * /sbin/poweroff

Does that help?

Member

phillxnet commented Feb 19, 2017

@MFlyer OK, on my ASUS N3700-ITX board I get:

journalctl | grep rtc
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: RTC can wake from S4
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: alarms up to one month, y3k, 242 bytes nvram
Feb 19 18:50:39 cube kernel: rtc_cmos 00:00: setting system clock to 2017-02-19 18:50:39 UTC (1487530239)

From memory isn't S4 essentially off anyway, S3 is regular suspend. I.e when bios set to have WOL doesn't that mean that off is S4 level and no deeper.
This motherboard is very likely to have wake on RTC, even from off, ie power down not just suspend.

Also from a NUC I have I get the following:

Feb 19 08:46:40 ytagit kernel: [    1.693588] rtc_cmos 00:05: RTC can wake from S4
Feb 19 08:46:40 ytagit kernel: [    1.693705] rtc_cmos 00:05: rtc core: registered rtc_cmos as rtc0
Feb 19 08:46:40 ytagit kernel: [    1.693734] rtc_cmos 00:05: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
Feb 19 08:46:40 ytagit kernel: [    1.708649] rtc_cmos 00:05: setting system clock to 2017-02-19 08:46:36 UTC (1487493996)

And this device wakes itself every morning via bios settings after shutting itself down via the following cron job every night:

# power off at 30 mins past midnight every day
30 0 * * * /sbin/poweroff

Does that help?

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 19, 2017

Member

Thanks for your feedback @phillxnet ,
got same output on my Rockstor dev env, but no wake up from power off, trying to understand if guest over Proxmox related or not (quite sure about virtualization issue / missing params)

Can you test system wake up on that ASUS with:

echo 0 > /sys/class/rtc/rtc0/wakealarm
echo `date '+%s' -d '+ 5 minutes'` > /sys/class/rtc/rtc0/wakealarm
shutdown -h now

On a working motherboard this will provide system wake up from power off after 5 mins

Member

MFlyer commented Feb 19, 2017

Thanks for your feedback @phillxnet ,
got same output on my Rockstor dev env, but no wake up from power off, trying to understand if guest over Proxmox related or not (quite sure about virtualization issue / missing params)

Can you test system wake up on that ASUS with:

echo 0 > /sys/class/rtc/rtc0/wakealarm
echo `date '+%s' -d '+ 5 minutes'` > /sys/class/rtc/rtc0/wakealarm
shutdown -h now

On a working motherboard this will provide system wake up from power off after 5 mins

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 20, 2017

Member

Having some tests with built-in rtcwake tool (shutdown/suspend + wake after 120 sec):

rtcwake -m disk -s 120 -> fails, mode disk is S4
rtcwake -m mem -s 120 -> ok, mode mem is S3
rtcwake -m off -s 120 -> fails, mod off is system poweroff S5
rtcwake -m freeze -s 120 -> VM seems running, but no response

S1 (standby) not available on my env

To @phillxnet : you can try rtcwake -m off -s 120 to check wakeup from off without playing with echos to wakealarm :)

Finally I still have working wakeup only on suspend to RAM

Member

MFlyer commented Feb 20, 2017

Having some tests with built-in rtcwake tool (shutdown/suspend + wake after 120 sec):

rtcwake -m disk -s 120 -> fails, mode disk is S4
rtcwake -m mem -s 120 -> ok, mode mem is S3
rtcwake -m off -s 120 -> fails, mod off is system poweroff S5
rtcwake -m freeze -s 120 -> VM seems running, but no response

S1 (standby) not available on my env

To @phillxnet : you can try rtcwake -m off -s 120 to check wakeup from off without playing with echos to wakealarm :)

Finally I still have working wakeup only on suspend to RAM

@maxhq

This comment has been minimized.

Show comment
Hide comment
@maxhq

maxhq Feb 20, 2017

Contributor

Hi @MFlyer, on my HP ProLiant MicroServer Gen8 I get:

Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: RTC can wake from S4
Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: rtc core: registered rtc_cmos as rtc0
Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: alarms up to one day, 114 bytes nvram, hpet irqs
Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: setting system clock to 2017-01-11 14:19:17 UTC (1484144357)
Contributor

maxhq commented Feb 20, 2017

Hi @MFlyer, on my HP ProLiant MicroServer Gen8 I get:

Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: RTC can wake from S4
Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: rtc core: registered rtc_cmos as rtc0
Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: alarms up to one day, 114 bytes nvram, hpet irqs
Jan 11 15:19:17 Sigurd kernel: rtc_cmos 00:01: setting system clock to 2017-01-11 14:19:17 UTC (1484144357)
@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 20, 2017

Member

Hi @maxhq ,
thanks for your feedback 👍
Can you try rtcwake -m mem -s 120 (suspend + wakeup) and rtcwake -m off -s 120 (poweroff + wakeup) ? Note: probably suspend + wakeup will work fine, not sure about poweroff + wakeup <- you' ll need to manually poweron your machine

Mirko

Member

MFlyer commented Feb 20, 2017

Hi @maxhq ,
thanks for your feedback 👍
Can you try rtcwake -m mem -s 120 (suspend + wakeup) and rtcwake -m off -s 120 (poweroff + wakeup) ? Note: probably suspend + wakeup will work fine, not sure about poweroff + wakeup <- you' ll need to manually poweron your machine

Mirko

@magicalyak

This comment has been minimized.

Show comment
Hide comment
@magicalyak

magicalyak Feb 20, 2017

Nothing on journalctl (it's pretty busy) but dmesg | grep rtc
[root@rocky ~]# dmesg | grep rtc
[ 7.694698] rtc_cmos 00:01: RTC can wake from S4
[ 7.695045] rtc_cmos 00:01: rtc core: registered rtc_cmos as rtc0
[ 7.695076] rtc_cmos 00:01: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
[ 7.733611] rtc_cmos 00:01: setting system clock to 2016-12-24 18:47:12 UTC (1482605232)

I'm not in a position shutdown/suspend and restart at the moment. My server is up 24/7 (it also runs DNS for me)

Server type:
[root@rocky ~]# dmesg | grep HP
[ 0.000000] DMI: HP ProLiant DL180se G6, BIOS O33 10/20/2012
[ 0.000000] ACPI: RSDP 0x00000000000FA170 000024 (v02 HP )
[ 0.000000] ACPI: XSDT 0x00000000BF770100 0000A4 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: FACP 0x00000000BF770290 0000F4 (v04 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: DSDT 0x00000000BF770740 005EF3 (v02 HP ProLiant 00000244 INTL 20051117)
[ 0.000000] ACPI: APIC 0x00000000BF770390 00011E (v02 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SPCR 0x00000000BF7704B0 000050 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: MCFG 0x00000000BF770500 00003C (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SPMI 0x00000000BF770540 000041 (v05 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SLIC 0x00000000BF770590 000176 (v01 HP SLIC1034 20121020 MSFT 00000097)
[ 0.000000] ACPI: BOOT 0x00000000BF770710 000028 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: OEMB 0x00000000BF77E040 00007A (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: HPET 0x00000000BF77A740 000038 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SRAT 0x00000000BF77A780 0001D0 (v02 HP ProLiant 00000001 INTL 00000001)
[ 0.000000] ACPI: SSDT 0x00000000BF780EA0 000363 (v01 HP ProLiant 00000012 INTL 20051117)
[ 0.000000] ACPI: EINJ 0x00000000BF77A950 000130 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: BERT 0x00000000BF77AAE0 000030 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: ERST 0x00000000BF77AB10 0001B0 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: HEST 0x00000000BF77ACC0 0000A8 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: HPET id: 0x8086a301 base: 0xfed00000
[ 8.847705] scsi 0:0:10:0: Enclosure HP DL18xG6BP 2.18 PQ: 0 ANSI: 5

magicalyak commented Feb 20, 2017

Nothing on journalctl (it's pretty busy) but dmesg | grep rtc
[root@rocky ~]# dmesg | grep rtc
[ 7.694698] rtc_cmos 00:01: RTC can wake from S4
[ 7.695045] rtc_cmos 00:01: rtc core: registered rtc_cmos as rtc0
[ 7.695076] rtc_cmos 00:01: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
[ 7.733611] rtc_cmos 00:01: setting system clock to 2016-12-24 18:47:12 UTC (1482605232)

I'm not in a position shutdown/suspend and restart at the moment. My server is up 24/7 (it also runs DNS for me)

Server type:
[root@rocky ~]# dmesg | grep HP
[ 0.000000] DMI: HP ProLiant DL180se G6, BIOS O33 10/20/2012
[ 0.000000] ACPI: RSDP 0x00000000000FA170 000024 (v02 HP )
[ 0.000000] ACPI: XSDT 0x00000000BF770100 0000A4 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: FACP 0x00000000BF770290 0000F4 (v04 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: DSDT 0x00000000BF770740 005EF3 (v02 HP ProLiant 00000244 INTL 20051117)
[ 0.000000] ACPI: APIC 0x00000000BF770390 00011E (v02 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SPCR 0x00000000BF7704B0 000050 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: MCFG 0x00000000BF770500 00003C (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SPMI 0x00000000BF770540 000041 (v05 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SLIC 0x00000000BF770590 000176 (v01 HP SLIC1034 20121020 MSFT 00000097)
[ 0.000000] ACPI: BOOT 0x00000000BF770710 000028 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: OEMB 0x00000000BF77E040 00007A (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: HPET 0x00000000BF77A740 000038 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: SRAT 0x00000000BF77A780 0001D0 (v02 HP ProLiant 00000001 INTL 00000001)
[ 0.000000] ACPI: SSDT 0x00000000BF780EA0 000363 (v01 HP ProLiant 00000012 INTL 20051117)
[ 0.000000] ACPI: EINJ 0x00000000BF77A950 000130 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: BERT 0x00000000BF77AAE0 000030 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: ERST 0x00000000BF77AB10 0001B0 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: HEST 0x00000000BF77ACC0 0000A8 (v01 HP ProLiant 20121020 MSFT 00000097)
[ 0.000000] ACPI: HPET id: 0x8086a301 base: 0xfed00000
[ 8.847705] scsi 0:0:10:0: Enclosure HP DL18xG6BP 2.18 PQ: 0 ANSI: 5

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 21, 2017

Adding System Suspend task
Refs to #735 #1306 and #1036 - Adding new suspend task on backend model
and view plus smart_manager migration patching
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 21, 2017

Adding Suspend task support on frontend
Refs to #735 #1306 #1036: If task is suspend, aka system suspend
to RAM, we force users to have a wake up!
Adding suspend too because probably many system won't support
full power off + wake, while suspend works

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 21, 2017

Adding System suspend to url dispatcher and command view
Refs to #735 #1306 #1036
Delay param for reboot and shutdown no more required, checking if
scheduled task via request.auth (none if command from WebUI, token if
over APIWrapper by scheduled task). When shutdown and reboot come from
a scheduled task we grant a 3 minute grace period to cancel it
New rtcepoch param used to pass desired system wakeup epoch for
shutdown and suspend
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 21, 2017

Task scheduler enhancements to wakeup system and adds to handle suspend
Refs to #735 #1306 #1036
Added new handler for suspend task, served by same script.
Wakeup need rtc hour/minute int to compute if task will be this day or
next day, data conversion here to avoid it over cron script, so we convert
from string to int only on db saving.

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 21, 2017

reboot-shutdown-suspend script rewrite
Refs to #735 #1306 #1036
APIWrapper no more sending delay, using instead epoch wakeup time
if present (delay checks moved to command view with token/not token req check)
On shutdown and suspend tasks we check if wakeup option is on and parse
cron time vs wakeup time to find if wake is on same day or next day

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 21, 2017

osi functions enhancements and adds
Refs to #735 #1306 #1036
system_shutdown and system_reboot run with a delta, default to now when
running from user input from WebUi and 3 mins when called via scheduled tasks
Added system_suspend function just running a systemctl suspend
Added wakeup functions set_system_rtc_wake and clean_system_rtc_wake:
set_system_rtc_wake is our core function to set system wakeup, writing to default
rtc0 wakealarm user wakeup time in epoch format, after flushing every wakeup value
with clean_system_rtc_wake (write 0 to clean every time or we raise a resurce busy err)
IMPORTANT: epoch can't be passed as a string, needed int -> write('%s' % epoch) fails

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
@maxhq

This comment has been minimized.

Show comment
Hide comment
@maxhq

maxhq Feb 24, 2017

Contributor

@MFlyer Sorry for the late feedback, but here are the results:

[root@Sigurd ~]# rtcwake -m mem -s 120
rtcwake: suspend to "mem" unavailable

... so it failed, but:

[root@Sigurd ~]# rtcwake -m off -s 120
rtcwake: wakeup from "off" using /dev/rtc0 at Fri Feb 24 01:01:59 2017

... and it automatically powered on again!

Contributor

maxhq commented Feb 24, 2017

@MFlyer Sorry for the late feedback, but here are the results:

[root@Sigurd ~]# rtcwake -m mem -s 120
rtcwake: suspend to "mem" unavailable

... so it failed, but:

[root@Sigurd ~]# rtcwake -m off -s 120
rtcwake: wakeup from "off" using /dev/rtc0 at Fri Feb 24 01:01:59 2017

... and it automatically powered on again!

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Feb 24, 2017

Member

Thanks @maxhq !
So on my side fails over poweroff and works on mem, on your side works on poweroff and fails over mem eheh

Conclusion: will go on with current coding - having both shutdown and suspend option, telling users to test and choose 😉

Member

MFlyer commented Feb 24, 2017

Thanks @maxhq !
So on my side fails over poweroff and works on mem, on your side works on poweroff and fails over mem eheh

Conclusion: will go on with current coding - having both shutdown and suspend option, telling users to test and choose 😉

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 24, 2017

Adding new filter over task tyep
Refs to #735 #1306 #1036 - Added new else statement over tasks list page
to handle common tasks like shutdown, suspend and reboot

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 27, 2017

Models.js mods to add wakeup fields
Refs to #735 #1306 #1036 - Added new wakeup, rtc_hour and rtc_minute
fields to backbone properties for Task object

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 27, 2017

Scheduled tasks templates and views cleaning
Refs to #735 #1306 #1036 - Cleaned template structure
Before this commit we had a page with 2 templates (main template and
optional-fields template), "child" optional-fields template was used
only when creating new tasks, tasks edit had a messy if else group on
main template -> Moved all to optional-fields rendering on edit too

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 27, 2017

Templates and views reordering
Refs to #735 #1306 #1036
Scheduling task has a complete new view handling tasks edit over
optional-fields template instead of main template
Added some helpers (jquery helpers and Handlebars Helpers) for new
shutdown/suspend/reboot tasks plus Handlebars Partials to have global
vars to make taskObj available to main template and optional-fields
template to. @schakrava check inline comments for more infos ;)

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 28, 2017

Python PEP8
Refs #735 #1306 #1036 - Flake8 for some files

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 28, 2017

Javascript code rebase and linting
Refs to #735 #1306 #1036

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Feb 28, 2017

Second linting session (hand linting)
Refs #735 #1306 #1036

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 2, 2017

Adding warning for RTC WAKEUP capabiliets
Refs to #735 #1306 #1036 - Added user warning to check/test RTC WAKEUP capabilities
before setting a shutdown/suspend task

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 3, 2017

Adding new task types to task logs page
Refs to #735 #1306 #1036
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 4, 2017

Adding Shutdown/Reboot tasks layout alerts elements
Refs #735 #1306 #1036 - Added ad hoc div to alert user about scheduled
shutdown/reboot task
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 4, 2017

Adding systemd-shutdownd service
Refs to #735 #1306 #1036 - Added systemd-shutdownd service to available services
for monitoring. Service turns on (rc=0) when a system shutdown/reboot scheduled,
turns off (rc=3) if no shutdowns scheduled

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 4, 2017

Adding new Socket.io handler for system shutdown/reboot checks
Refs to #735 #1306 #1036 - frontend/backend adds to control pending
shutdown/reboot tasks. data_collector checks every 30 secs if we have
a pending shutdown (if scheduled returns shutdown message with time infos too)
On fronted we alert user with a message over Rockstor navbar

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

#735 #1306 adding init commit, defining reboot task type
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

System/osi reboot and shutdown refactoring
Refs to #735 and #1306 - reboot and shutdown funcs already used
when performing those action via WebUI. Scheduled reboots/shutdowns
will have a 2 min delay (shutdown now is instead 1 min) to allow
users to stop system shutdown too

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Reboot and Shutdown tasks - adding url dispatcher and view params
Refs to #735 and #1306 - Url Dispatcher updated to handle new
reboot/shutdown delay param, same done over commands view
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

RTC System Wake up custom fields
Refs to #735 #1306 - Adding rtc wake up hour and minute fields to
shutdown template plus auto toggle on rtc wake up checkbox

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding System Suspend task
Refs to #735 #1306 and #1036 - Adding new suspend task on backend model
and view plus smart_manager migration patching
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding Suspend task support on frontend
Refs to #735 #1306 #1036: If task is suspend, aka system suspend
to RAM, we force users to have a wake up!
Adding suspend too because probably many system won't support
full power off + wake, while suspend works

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding System suspend to url dispatcher and command view
Refs to #735 #1306 #1036
Delay param for reboot and shutdown no more required, checking if
scheduled task via request.auth (none if command from WebUI, token if
over APIWrapper by scheduled task). When shutdown and reboot come from
a scheduled task we grant a 3 minute grace period to cancel it
New rtcepoch param used to pass desired system wakeup epoch for
shutdown and suspend
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Task scheduler enhancements to wakeup system and adds to handle suspend
Refs to #735 #1306 #1036
Added new handler for suspend task, served by same script.
Wakeup need rtc hour/minute int to compute if task will be this day or
next day, data conversion here to avoid it over cron script, so we convert
from string to int only on db saving.

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

reboot-shutdown-suspend script rewrite
Refs to #735 #1306 #1036
APIWrapper no more sending delay, using instead epoch wakeup time
if present (delay checks moved to command view with token/not token req check)
On shutdown and suspend tasks we check if wakeup option is on and parse
cron time vs wakeup time to find if wake is on same day or next day

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

osi functions enhancements and adds
Refs to #735 #1306 #1036
system_shutdown and system_reboot run with a delta, default to now when
running from user input from WebUi and 3 mins when called via scheduled tasks
Added system_suspend function just running a systemctl suspend
Added wakeup functions set_system_rtc_wake and clean_system_rtc_wake:
set_system_rtc_wake is our core function to set system wakeup, writing to default
rtc0 wakealarm user wakeup time in epoch format, after flushing every wakeup value
with clean_system_rtc_wake (write 0 to clean every time or we raise a resurce busy err)
IMPORTANT: epoch can't be passed as a string, needed int -> write('%s' % epoch) fails

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding new filter over task tyep
Refs to #735 #1306 #1036 - Added new else statement over tasks list page
to handle common tasks like shutdown, suspend and reboot

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Models.js mods to add wakeup fields
Refs to #735 #1306 #1036 - Added new wakeup, rtc_hour and rtc_minute
fields to backbone properties for Task object

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Scheduled tasks templates and views cleaning
Refs to #735 #1306 #1036 - Cleaned template structure
Before this commit we had a page with 2 templates (main template and
optional-fields template), "child" optional-fields template was used
only when creating new tasks, tasks edit had a messy if else group on
main template -> Moved all to optional-fields rendering on edit too

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Templates and views reordering
Refs to #735 #1306 #1036
Scheduling task has a complete new view handling tasks edit over
optional-fields template instead of main template
Added some helpers (jquery helpers and Handlebars Helpers) for new
shutdown/suspend/reboot tasks plus Handlebars Partials to have global
vars to make taskObj available to main template and optional-fields
template to. @schakrava check inline comments for more infos ;)

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Python PEP8
Refs #735 #1306 #1036 - Flake8 for some files

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Javascript code rebase and linting
Refs to #735 #1306 #1036

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Second linting session (hand linting)
Refs #735 #1306 #1036

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding warning for RTC WAKEUP capabiliets
Refs to #735 #1306 #1036 - Added user warning to check/test RTC WAKEUP capabilities
before setting a shutdown/suspend task

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding new task types to task logs page
Refs to #735 #1306 #1036
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding Shutdown/Reboot tasks layout alerts elements
Refs #735 #1306 #1036 - Added ad hoc div to alert user about scheduled
shutdown/reboot task
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding systemd-shutdownd service
Refs to #735 #1306 #1036 - Added systemd-shutdownd service to available services
for monitoring. Service turns on (rc=0) when a system shutdown/reboot scheduled,
turns off (rc=3) if no shutdowns scheduled

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>

MFlyer added a commit to MFlyer/rockstor-core that referenced this issue Mar 8, 2017

Adding new Socket.io handler for system shutdown/reboot checks
Refs to #735 #1306 #1036 - frontend/backend adds to control pending
shutdown/reboot tasks. data_collector checks every 30 secs if we have
a pending shutdown (if scheduled returns shutdown message with time infos too)
On fronted we alert user with a message over Rockstor navbar

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Mar 23, 2017

Member

Hi @schakrava , like on #1306 i missed Fixes statement on commits.
Can be closed
M.

Member

MFlyer commented Mar 23, 2017

Hi @schakrava , like on #1306 i missed Fixes statement on commits.
Can be closed
M.

@schakrava schakrava modified the milestones: Point Bonita, Yosemite Mar 24, 2017

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Apr 4, 2017

Member

After Yum updates back on this: new job on May 🎉 , new nephew (welcome Zeno!!!), new cool issue 😃

Mirko

Member

MFlyer commented Apr 4, 2017

After Yum updates back on this: new job on May 🎉 , new nephew (welcome Zeno!!!), new cool issue 😃

Mirko

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Apr 18, 2017

Member

Starting up again with a fresh new branch from last rockstor core updates

Member

MFlyer commented Apr 18, 2017

Starting up again with a fresh new branch from last rockstor core updates

@phillxnet

This comment has been minimized.

Show comment
Hide comment
@phillxnet

phillxnet Jul 27, 2017

Member

@MFlyer Am I right that this can be closed as Fixed by pr #1659
Your linked other issue #1306 has now been closed.
Bit confusing as further comment there after!

Member

phillxnet commented Jul 27, 2017

@MFlyer Am I right that this can be closed as Fixed by pr #1659
Your linked other issue #1306 has now been closed.
Bit confusing as further comment there after!

@MFlyer

This comment has been minimized.

Show comment
Hide comment
@MFlyer

MFlyer Jul 27, 2017

Member

You're right @phillxnet , already told it to @schakrava on previous message :)
Mirko

Member

MFlyer commented Jul 27, 2017

You're right @phillxnet , already told it to @schakrava on previous message :)
Mirko

@schakrava

This comment has been minimized.

Show comment
Hide comment
@schakrava

schakrava Aug 28, 2017

Member

Thank you @MFlyer ! Sorry this got missed.

Member

schakrava commented Aug 28, 2017

Thank you @MFlyer ! Sorry this got missed.

@schakrava schakrava closed this Aug 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment