One of the main causes for Clocktimizer not performing its nightly import is due to the fact that the IIS web server will sleep any inactive apps. Unfortunately, IIS will sleep Clocktimizer overnight due to periods of inactivity. And this will prevent the nightly (or weekend) import from running. 


In order to counteract this, when Clocktimizer is deployed on your system, we configure a scheduled task to ping the application every 15 minutes. This tricks IIS into thinking that the app is active 24hrs a day, and prevents the sleep action.


Sometimes, however, we experience issues with this task. For example, the credentials of the service account may have changed. 


This guide will explain some quick checks you can perform, and some actions to fix the task.


Diagnosing an issue with the wake-up task


If your Clocktimizer data is stale, it may be that the application has been asleep during its scheduled import time. You can easily check this by reading the logs.


Download the logs in Clocktimizer by going to 'Support->Download Logs'.


Here are two telltale signs that the task is not running:


  • Log files for the weekend are missing
  • Log files stop reporting at night, and the first log line is ~8-9 AM when the first user logs on.


If any of these are consistently true. Then you should inspect the wake-up task. To do this. You will have to open the 'Task Scheduler' on the web-server.


Firstly, you must check that there exists a task named 'Wake Clocktimizer'. If this does not exist, then read the section on how to go about creating a new task.


If the task exists, then you should check the following data points:


1. The last run time should be within the past 15 minutes

2. The last run result should read (0x0)

3. The run history should contain no errors.


If any of the above is not correct, then proceed to the next section on 'Common Issues'.


Common issues


  • Account credentials
    • Ensure that the service account is registered to this task, and the credentials are correct
  • The task may be disabled
  • The wake-up script may be blocked by Windows. 
    • In order to correct this, Find the wake-up script in the following directory
    • Clocktimizer/Environments/<ENVIRONMENT>/Multitenant/WakeUp-ENVIONMENT.ps1
    • Right-click the file and open 'Properties'
    • In the Security tab, check the 'Unblock' tick-mark
  • Wake-up script path
    • The 'Action' of the task should be a PowerShell command with the following parameter. (See below on how to find the wake-up script) 
    • -nologo -noprofile -noninteractive -executionpolicy bypass "&{<PATH TO WAKEUP SCRIPT>}"



Creating the task


If the task does not exist, you will have to create it. This is fairly straightforward. Follow the steps below:


1. Open 'Task Scheduler' on the web-server.

2. Create a new task, named 'Wake Clocktimizer', and select the 'General' tab

3. Fill out the user account. The account should be the service account for the Clocktimizer application

4. The task must be configured to 'Run whether user is logged in or not'


5. Once that's done, select the 'Triggers' tab to create a new trigger

6. Create a 'Daily' task to repeat every 1 days

7. The task must repeat every 15 minutes



8. Then, go to the 'Actions' tab and create a new action

9. In the 'Program/script' box, enter powershell.exe

10. In the Clocktimizer install directory, navigate to the 'Environments/ENVIRONMENT/Multitenant' directory, and find the 'WakeUp-ENVIRONMENT.ps1' file. Copy the path to this file

11. In the 'Arguments' box enter the line below, replacing the <PATH TO WAKEUP SCRIPT> placeholder with the path you copied in step 10. No double quotes in the path

-nologo -noprofile -noninteractive -executionpolicy bypass "&{<PATH TO WAKEUP SCRIPT>}"


 

12. Save the task, and enter the password of the service account when prompted.


If you're having trouble setting up the wake-up task, or the import isn't running even though the wake-up task is working correctly, please get in touch with us.