Southsoftware.com
.:Pricing
Home
Products
Downloads
Support
Contacts
Site Map
.:Advanced Task Scheduler
About product
Download trial
Purchase license
Compare editions
View screenshot
FAQ & Support
Press Kit
.:Articles
Online manual
Blog posts
Videos
More articles...
.:Follow us
Follow us on Facebook Follow us on Twitter Follow us on YouTube
   

Advanced Task Scheduler Articles

Error handling in scheduled tasks

A scheduled task can be run automatically many times after it has been created, configured and tested. But what if something goes wrong, for example, the task depends on a file that has been renamed or moved, Internet connection interrupts when the task is being executed? The administrator may want to know about the problem. That is why Advanced Task Scheduler introduces error handling features, which allow taking actions when something wrong happens.

Logging and log files

During execution, Advanced Task Scheduler records task execution messages in a log file or sends them to an email address. Logging options can be configured in the Options section on the user’s tab of the Preferences window.

To enable logging and specify log file name: check the “Write Log File” option, in the text box next to this option enter file name of the file where you wish to record log entries. You can check the “Split Log File” option and specify maximum size for a single log file. When size of your log file reaches maximum, Advanced Task Scheduler will create new log file by adding or increasing index number in its file name.

To enable sending logs to email address: check the “Send Logs to EMail” option and specify email address and SMTP options. In Advanced Task Scheduler Professional and Network editions you can send every log message as a separate email or send a bunch of log messages in a single email once a day, week or month.

To log failed tasks only: check the “Log failed tasks only” option. This option is good for error handling. Advanced Task Scheduler will record or email log entries for failed tasks only.

Logging and log files

Conditions

In addition to error logging Advanced Task Scheduler Professional and Network editions provide more powerful error handling feature – conditions. Conditions allow executing one sequence of commands or another depending on the condition. Advanced Task Scheduler allows conditions based on error code or exit code of the program started. Error code is a code that Operating System reports when it starts the program. For example, if the program’s executable file does not exist, you’ll receive either 2 (File not found) or 3 (Path not found) error code. Error code “0” means that the program has been started successfully. Every program on Windows returns its exit code (integer value) when it finishes to execute. In general, exit code is the result of the operation that the program has been performed.

Thus, you can check last error code or last exit code of the program you started and perform different operations in case of success or failure. The example below demonstrates a task that displays message box when program fails to start. In real life, you can send an email message or use any other commands to notify yourself about the error or perform other error handling operations.

LastErrorCode conditions in Advanced Task Scheduler Professional

The example below, demonstrates how to check last exit code. The task will display a message asking user to click either “Yes” or “No” button. And will respond user by displaying different messages depending on what button has been clicked.

LastExitCode conditions in Advanced Task Scheduler Professional

Advanced error handling

If you are familiar with Perl or Python programming language, you can use the power or those programming languages by writing scripts that handling more complex conditions and operations. As Advanced Task Scheduler comes with internal portable Perl and Python interpreters, you can schedule scripts that will run from Advanced Task Scheduler on any system where Advanced Task Scheduler is installed, no need to install interpreters separately.

Advanced Task Scheduler in Windows Safe Mode

It is possible to start Advanced Task Scheduler Service in Windows Safe Mode, so that the tasks created on the All Users tab of Advanced Task Scheduler will run automatically when Windows is loaded in Safe Mode.

In general, it is possible to start any additional services and drivers in safe mode. To do that, you need to start some registry editor such as REGEDIT and select the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot, which has sub-keys of Minimal and Network. Minimal is for safe mode, Network is for safe mode with networking. To allow a service or driver in the corresponding safe mode, add a key for the service or driver short name, then a string for type.

The screenshot below demonstrates how to add Advanced Task Scheduler Service to start in safe mode.

Advanced Task Scheduler in Windows Safe Mode

Installing Advanced Task Scheduler to run in Safe Mode

The entry below, when entered into registry, allows Advanced Task Scheduler Service to start in safe mode:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\advschedulerbsc]
@="Service"

The entry below, when entered into registry, allows Advanced Task Scheduler Service to start in safe mode with networking:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\advschedulerbsc]
@="Service"

Installing Advanced Task Scheduler Professional to run in Safe Mode

The entry below, when entered into registry, allows Advanced Task Scheduler Professional Service to start in safe mode:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\advschedulerpro]
@="Service"

The entry below, when entered into registry, allows Advanced Task Scheduler Professional Service to start in safe mode with networking:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\advschedulerpro]
@="Service"

Installing Advanced Task Scheduler Network to run in Safe Mode

The entry below, when entered into registry, allows Advanced Task Scheduler Network Service to start in safe mode:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\advschedulernet]
@="Service"

The entry below, when entered into registry, allows Advanced Task Scheduler Network Service to start in safe mode with networking:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\advschedulernet]
@="Service"

Caution

You should always be very careful not to modify parts of the registry other than those expressly mentioned. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. It cannot be guaranteed that problems resulting from the incorrect use of Registry Editor can be solved.

Run scheduled tasks when no user is logged on into the system

To set up Advanced Task Scheduler to run tasks in background when no user is logged on into the system:

  1. Create your task on the “All Users” tab.
  2. Select the “Run task on the hidden desktop” option on the “User Account Options” tab of the Task Properties window.
  3. Select the “Start task under the following account” option and choose the “Service account” on the “User Account Options” tab of the Task Properties window.

Creating task that runs when no user is logged on into the system in Advanced Task Scheduler Professional

Network access

Please note that if your task runs on All Users tab and uses a network drive, you may get Access Denied or similar error. In that case you need to change user account for Advanced Task Scheduler Service from LocalSystem to an administrator account. To change service account go to Control Panel | Administrative Tools | Services, double click Advanced Task Scheduler Service and specify user account on the Log On tab of the Service Properties window.

User input

Please make sure that your task does not require user’s input. As the task is executed on the hidden desktop, no user will be able to communicate with it.

Active user

Hidden task will start on the hidden desktop transparently for all logged on users. So the task will start always on the hidden desktop no matter what user is logged on and working on the system. The “User accounts (All users only)” options on the “User Account Options” tab of the Task Properties window are ignored.

Video tutorial

Schedule task when no user is logged on into the system :

Automate FTP transfers with Advanced Task Scheduler

Advanced Task Scheduler allows uploading, downloading and deleting files from an FTP or Secure FTP (FTPS) server. These operations can be scheduled to run in a specified time, time intervals, or by such events as file modification or creation. Advanced Task Scheduler can run FTP transfers when a specified user is logged on to the system or run them in background even when no user is logged on.

All editions of Advanced Task Scheduler support FTP operations. The examples below are for Advanced Task Scheduler Professional.

Upload a file to an FTP server

To upload a file to an FTP server with Advanced Task Scheduler, create a task with FTP upload shortcut type. Enter path to the file you want to upload to the Local dir field, select the Include files check box and enter name of the file to the field next to check box. FTP server address and directory is specified in the Remote dir field. Server address must start with ftp:// or ftps:// prefix.

In the If destination file already exists box you can choose how to process already existing files: leave them or overwrite.

There are FTP options in the bottom of the dialog where you can enter username/password and set tunneling proxy settings.

FTP Upload

Download a file from an FTP server

To download a file from an FTP server with Advanced Task Scheduler, create a task with FTP download shortcut type. Enter FTP server address and directory where the file is located to the Remote dir field. Server address must start with ftp:// or ftps:// prefix. Enter path to a folder where you want to download the file to the Local dir filed, select the Include files check box and enter name of the file to the field next to check box.

In the If destination file already exists box you can choose how to process already existing files: leave them or overwrite.

There are FTP options in the bottom of the dialog where you can enter username/password and set tunneling proxy settings.

FTP Download

Upload and download a folder or directory tree

In addition to single file transfer, Advanced Task Scheduler allows FTP operations with multiple files. The Include files and Exclude files fields are used to configure multiple file transfer.

  • When both Include files and Exclude files check boxes are unchecked, all files and all subfolders are uploaded or downloaded.
  • The Include files field contains a list of files or filemasks to include. Several files and filemasks separated by semicolon can be specified.
    For example, “file.txt;*.doc” will include the file.txt file and all .doc files.
  • The Exclude files field contains a list of files or filemasks to exclude. Several files and filemasks separated by semicolon can be specified.
    For example, “file.txt;*.doc” will exclude the file.txt file and all .doc files.
  • To include or exclude files in subfolders, directory separators (“\”) can be used in filemasks.
    For example, “file.txt” – include or exclude file.txt file only,
    dir\file.txt” – include or exclude file.txt file from “dir” subfolder only,
    *.txt” – include or exclude all .txt files from all subfolders,
    dir\*.txt” – include .txt files from “dir” and all its subdirectories.
  • To download files without recursing down directories in the file system, specify “*\*.*” in the Exclude files field.

Delete files from an FTP server

To delete files from an FTP server with Advanced Task Scheduler, create a task with FTP delete schedule type.
The task options are very similar to the upload and download schedule types.

Error handling if FTP fails

FTP operations return number of files affected in the LastExitCode value. You can check that value in the IF statement. Please note that if you use Leave existing file option, the left files will not count. The task in the example below displays success or fail message depending on the result on the FTP upload operation.

FTP Task

Perl scripting in Advanced Task Scheduler

Internal and standard Perl interpreter
Advanced Task Scheduler comes with internal portable Perl interpreter. You only need to install Advanced Task Scheduler, create a Perl script task and use all Perl scripting power.

Perl Task
Perl Execution Log

Getting Perl version
The script below displays current Perl version to the task execution log:

print "Version: $]";

Current task’s arguments
The script below displays the %advscheduler hash variable to the task execution log:

foreach $key (keys %advscheduler) {
  print $key, "=", $advscheduler{$key}, "\n";
}

Load code from external files
The script below runs Perl code from the filename.pl file:

require 'filename.pl';

For portable Perl the filename.pl file must be located in the current directory or in a directory listed in the Additional library path option in the Scripts section of the Preferences window. For installed Perl the filename.pl file must be located in the current directory or in a directory listed in the PERL5LIB environment variable.

Commander features
Perl script can call some Advanced Task Scheduler features via the Command line tool. The example below demonstrates how to send an e-mail message to a GMail address:

system($commander,
"--SendEMail",
"-email",
"username\@gmail.com",
"-server",
"smtp.gmail.com:587",
"-auth",
"username\@gmail.com",
"password",
"-starttls",
"-sender",
"sender\@mail.com",
"-subject",
"Subject",
"-msg",
"Text") == 0 or die "system @args failed: $?"

Where $commander is file name and path to the Command line tool: advscheduler_commander.exe, advscheduler_procmd.exe (Professional Edition) or advscheduler_netcmd.exe (Network Edition). Command line described in the Command line tool topic.

   
About us   Privacy policy   Terms of use   Link to us
Current Version: 5.0.0.700
The following prices are based on a single order:
Basic Edition 32 and 64-bit$ 39.95 USD
Professional Edition 32 and 64-bit$ 59.95 USD
Network Edition 32 and 64-bit$ 149.95 USD
.:Testimonials

I use Advanced Task Scheduler to run my backups jobs. After performing a backup by standard Windows 2003 Server means, Advanced Task Scheduler launches a script which copies files. I am glad I chose your program.

Rob Hannigan

.:Requirements
Computer: Minimum required by operating system you are running.
Disk Space: Under 30 MB
Operating System: Microsoft Windows 32-bit or 64-bit.
Read more...