Page 1 of 1
Execute a package at each machine restart
Published: July 15, 2021 - 10:44 AM
by tuxmania
Hello,
is it possible to make a package run every time WAPT starts?
I have a package that needs to run once a day (like a scheduled task), but without having to increment the package version every day!
Is there a way to do this?
Thanks in advance.
Re: Running a package on each computer restart
Published: July 15, 2021 - 9:29 PM
by dcardon
See the forum rules above.
You could create a scheduled task that performs a force install at each startup. That said, we would need a little more information to give a more informed opinion.
Regards,
Denis
Re: Running a package on each computer restart
Published: July 16, 2021 - 09:38
by tuxmania
Hello Denis,
thank you for your reply.
Here's some more information:
Wapt agent version: 1.8.2,
OS: Windows 10.
To elaborate on my request, I have a Python script that retrieves the timezone from the internet based on the user's geographical location (using the IP address). From there, the script applies the correct timezone to the PC by modifying the settings in Windows.
The idea of forcing the script to execute every time Wapt is launched would allow (for people who travel to different timezones) for automatic timezone adjustment.
My goal was to use only Python and not batch scripts or PowerShell.
Thank you in advance.
Re: Running a package on each computer restart
Published: July 16, 2021 - 12:06 PM
by florentR2
Scheduling an audit every X hours should do the trick.
However, it won't necessarily run when the PC starts up.
Re: Running a package on each computer restart
Published: July 16, 2021 - 7:00 PM
by tuxmania
Hi florentR2,
thanks for the feedback.
I added the "audit_schedule" attribute to the control file with a value of "1m" but nothing happens.
Do I need to add an "audit" function to setup.py or make another modification?
Thanks in advance.
Re: Running a package on each computer restart
Published: July 19, 2021 - 08:59
by florentR2
Yes, you need an audit() function
Code: Select all
def audit():
# put here code to check periodically that state is matching expectations
# return "OK", "WARNING" or "ERROR" to report status in console.
# all print statement are reported too
return "OK"
Re: Running a package on each computer restart
Published: July 19, 2021 - 11:18 AM
by tuxmania
Hello florentR2,
thank you very much for your feedback.
I will do it that way.
Have a good day.