bnosac / taskscheduleR

Schedule R scripts/processes with the Windows task scheduler.
331 stars 72 forks source link

Run when not plugged in #42

Closed ghost closed 6 years ago

ghost commented 6 years ago

The default setting is that the task will only run when my laptop is plugged in. Is there a way to change this setting to allow tasks to run even when not plugged in?

jwijffels commented 6 years ago

I don’t understand what you mean with plugged in? A task can only be executed if your computer is switched on and is not in sleep mode. Is that your question?

ibombonato commented 6 years ago

There is an option that prevent the task to start if the computer is not plugged in on AC power, I think 3mzel is refering to that.

image

jwijffels commented 6 years ago

I haven't seen this option the documentation of schtasks.exe /Create /? if you run it in a shell. What option is this in schtasks.exe?

jwijffels commented 6 years ago

I think that option is not part of schtasks.exe what you need to do is explained at https://stackoverflow.com/questions/9075564/change-settings-for-power-for-windows-scheduled-task#9075595 Create an XML file with this content

<Settings>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
</Settings>

and pass it on to schtasks_extrawhen calling taskscheduler_createas "/XML yourfilename.xml"

jwijffels commented 6 years ago

Closing this as I don't think this is possible easily using the schtasks.exe program which this R package is using to schedule jobs.