Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

auto close resolved tickets after 3 days

Hi, I was wondering if there is a feature to automatically close resolved tickets after 3 days.
Is the a scheduled task I can run from windows schedule task manager to close all tickets that were set to resolved status 3 days ago.

Many thanks

Johnny B


  • You'd need to make a script that checks the ticket status and the age of a ticket which then runs via scheduled tasks to do this. And no, there is currently no solution built-in / shipped with osTicket to do so.
  • Would you know what would be the SQL to do this direct on the Database ?

  • No, but my approach would be to look at the ticket closing function, export it to a script and then code another query for the status / 3 days time span.

    I know that's not the answer you hoped for, but that's all I can advise.
  • have been playing.

    Update MY_ticket.ost_ticket set status_id = 3 where status_id = 2 and DATEDIFF(now(), updated ) > 3; 

    Just need to put this is a script now and schedule it.

  • edited June 2015
    I think this SQL is better:

    *** change ost_DB to the ost database name.

    use ost_DB;
    update ost_DB.ost_ticket 
    inner join ost_ticket_status on ost_ticket.status_id = 
    set ost_ticket.status_id = 
    (select from ost_ticket_status where like 'closed')
    where like 'resolved' 
    and DATEDIFF(now(), ost_ticket.updated ) > 3; 

    I am going to schedule this with windows task scheduler. the command to schedule is:
    mysql -hlocalhost -uthe_userid -pthe_password < The_sql_File.SQL > the_output_File.txt

    I am thinking it would be good to have a feature in OST that allows you run SQL command on a schedule.

    If anyone else uses this I'd appreciate feed back.
  • Looks really good! Won't need it myself, but thank you for sharing! :)
  • You're welcome
  • Does this still work in 1.10.1?

    I'm trying it out and it runs just fine, but it doesn't seem to be affecting anything in my ticketing system or database.

    I also get no output into my log file.
  • There is now a third-party plugin which can do this.

Sign In or Register to comment.