Schedule script to run.
Schedule script to run.
I would like a script to run at a certain time of the day. I assume, I need to have my scheduler call xyplorer with command line switches, but what command line switch do I use to indicate the script to run, once its launched, and then have it close down the instance after the script has finished?
Thanks, Tim
Thanks, Tim
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Schedule script to run.
Not implemented. Maybe later I can add a switch /load=[xys file]...
FAQ | XY News RSS | XY Twitter
Re: Schedule script to run.
Shouldn't it be called /exec= or /script= to better show what it's for?admin wrote:Not implemented. Maybe later I can add a switch /load=[xys file]...
And didn't we talk about an initial script? Then calling xy with a .ini containing an initial script could achieve the same.
(But I think both could be helpful.)
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Schedule script to run.
Yes, /script= looks good.PeterH wrote:Shouldn't it be called /exec= or /script= to better show what it's for?admin wrote:Not implemented. Maybe later I can add a switch /load=[xys file]...
And didn't we talk about an initial script? Then calling xy with a .ini containing an initial script could achieve the same.
(But I think both could be helpful.)
Initial could be handled as CEA (on event "startup": load script...) in future.
FAQ | XY News RSS | XY Twitter
Re: Schedule script to run.
It would be nice to have another switch to tell the system to not show the gui, so it just stays hidden while it executes, and then unloads from memory nicely when the script finishes.
tim
tim
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Schedule script to run.
Just curious: what kind of script is that? Backup?timhatz wrote:It would be nice to have another switch to tell the system to not show the gui, so it just stays hidden while it executes, and then unloads from memory nicely when the script finishes.
tim
FAQ | XY News RSS | XY Twitter
Re: Schedule script to run.
For an example it would be nice to automate the delete of files older than 10 days in a folder based on a filter.
Without having to run it manually.
Tim
Without having to run it manually.
Tim
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Schedule script to run.
I see. I'm not very fond of this kind of automatic stuff. Too dangerous, too robotic. Think of freaking robots in science fiction...timhatz wrote:For an example it would be nice to automate the delete of files older than 10 days in a folder based on a filter.
Without having to run it manually.
But, with a little effort, you could do it with scripting: A script that runs a number of other scripts once per day. So all you'd have to do is press a button once, and then all your daily one-time routines would be performed. If you press again, the button would know (INI storage) that he did the job already today and do nothing. The later, if we have CEA, you could tie this button to any event (e.g. startup). That way, using XY (and triggering that event) would ensure the jobs get done.
FAQ | XY News RSS | XY Twitter
Re: Schedule script to run.
Just for the example, I do have something like that myself (Note: this is a simple copy/paste, I haven't had the time to use the "new" loops/etc) :admin wrote:But, with a little effort, you could do it with scripting: A script that runs a number of other scripts once per day. So all you'd have to do is press a button once, and then all your daily one-time routines would be performed. If you press again, the button would know (INI storage) that he did the job already today and do nothing. The later, if we have CEA, you could tie this button to any event (e.g. startup). That way, using XY (and triggering that event) would ensure the jobs get done.
Code: Select all
"Do cron jobs : doCron"
global $CRON_list;
sub _ensureXY;
self $base, base;
$today = <date dd/mm/yyyy>;
getkey $lastrun, "LastRun", "Settings", "$base.ini";
// if we already ran today, we stop here
end ($lastrun == $today),,1;
status "Processing cron jobs for today ($today)...",,progress;
getkey $CRON_list, "list", "Jobs", "$base.ini";
$CRON_list = "$CRON_list,";
// adds a last coma to make things easier to work with on loop
setting "AllowRecursion", 1;
sub ($CRON_list != ",") ? "_cronLoop" : "_nothing";
setting "AllowRecursion", r;
//
// done for today!
setkey $today, "LastRun", "Settings", "$base.ini";
status "Cron jobs for today ($today) completed";
"_cronLoop"
global $CRON_list;
self $base, base;
// "extracts" first element on list
strpos $p, $CRON_list, ",";
substr $id, $CRON_list, 0, $p;
substr $CRON_list, $CRON_list, $p + 1;
//
// get definition of the cron job, and run it if condition evaluates to true -- simple as that!
getkey $condition, "Condition$id", "Jobs", "$base.ini";
getkey $script, "Script$id", "Jobs", "$base.ini";
load (eval($condition) ? $script : 'call'),,s;
//
end ($CRON_list == ""),,1;
sub _cronLoop;
Code: Select all
[Settings]
LastRun=23/09/2009
[Jobs]
list=1,2
Condition1=1
Script1=load 'dailyScript';
Condition2=<date w> == 2
Script2=load 'weeklyScript';
Proud XYplorer Fanatic
Re: Schedule script to run.
Yeah would like to have this as well for backup purposes.
Anyone?
Thank you.
Anyone?
Thank you.
Re: Schedule script to run.
Write a script that puts a call to your backup xys script into the windows task planner.
Use a second XY instance which shuts down after the script has ended.
Why? Because there is no way to examine if the main XY instance is currently running a script and feeding the backup script via /flg=2 into the main instance can fail because of this reason.
Use a second XY instance which shuts down after the script has ended.
Why? Because there is no way to examine if the main XY instance is currently running a script and feeding the backup script via /flg=2 into the main instance can fail because of this reason.
One of my scripts helped you out? Please donate via Paypal
Re: Schedule script to run.
I've already had a program that could handle schedule.
Is there any chance that I could do this?
Is there any chance that I could do this?
Re: Schedule script to run.
Do a schedule with a script file.
Re: Schedule script to run.
Yeah, why not?
Write your backup script, but the call to it in the task planner (with a schedule). Done...
Write your backup script, but the call to it in the task planner (with a schedule). Done...
One of my scripts helped you out? Please donate via Paypal