Before posting, and to avoid disappointment, please read the following:

  • This forum is not for 2BrightSparks to provide technical support. It's primarily for users to help other users. Do not expect 2BrightSparks to answer any question posted to this forum.
  • If you find a bug in any of our software, please submit a support ticket. It does not matter if you are using our freeware, a beta version or you haven't yet purchased the software. We want to know about any and all bugs so we can fix them as soon as possible. We usually need more information and details from you to reproduce bugs and that is better done via a support ticket and not this forum.

Script doesn't run after backup job

For technical support visit https://support.2brightsparks.com/
Post Reply
nereus
Enthusiastic
Enthusiastic
Posts: 17
Joined: Thu Sep 02, 2010 9:02 am

Script doesn't run after backup job

Post by nereus »

Hello,

This is my first try at having SyncBackSE run a Python script after a job runs.

The script works fine when run manually. It grabs a web page from the Net, searches for something, and sends an email through my ISP's SMTP server.

Half-surprisingly, I'm getting no email.

To investigate, is there a way to log what happens?

FWIW, it's SyncBackSE 6.5.49.0.

Thank you.
nereus
Enthusiastic
Enthusiastic
Posts: 17
Joined: Thu Sep 02, 2010 9:02 am

Re: Script doesn't run after backup job

Post by nereus »

It looks a bit involved on Windows. I'll move that script to a Linux host instead.
jennybaso
Newbie
Newbie
Posts: 2
Joined: Wed Oct 02, 2024 4:38 am

Re: Script doesn't run after backup job

Post by jennybaso »

Add logging functionality to your Python script to capture output and errors. You can use the logging module to write logs to a file. Here’s a basic example :

Code: Select all

import logging

# Configure logging
logging.basicConfig(filename='script_log.txt', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')

try:
    # Your code here
    logging.info('Script started')
    # Example: grabbing web page
    # ...

    logging.info('Email sent successfully')
except Exception as e:
    logging.error(f'Error occurred: {e}')
Make sure that the job in SyncBackSE is configured correctly to run your script after the backup completes. Check that the path to the Python executable and your script is correct.
MikeTaku
Experienced
Experienced
Posts: 36
Joined: Thu Oct 03, 2024 1:16 pm

Re: Script doesn't run after backup job

Post by MikeTaku »

I think to troubleshoot your Python script not sending an email after a SyncBackSE job, start by enabling detailed logging in SyncBackSE to track what happens after the job runs. Add logging or print statements in your Python script to check if it’s being triggered and where it might fail. Ensure SyncBackSE is correctly set to run the Python script with the right interpreter and permissions. This way, you can see if the script is running and diagnose any issues with email sending.
Mike Taku.
Post Reply