How Can I Schedule One-Time Scripts and Processes?

0
16
Asked By CuriousCat123 On

I'm looking for some help with finding DevOps solutions for running one-time scripts or processes at specific times, like for manual schema updates. For instance, I need to execute a SQL command on a weekend at 10 PM when no one is around. It would be really helpful if I could schedule this command to run and have the results emailed to us afterward. Additionally, I'm looking to schedule other scripts, such as Bash or Python scripts, due to certain requirements from downstream applications that need to run at a specific time, like two weeks from now at 10 PM on a Saturday.

I know GitLab CI seems better suited for recurring tasks rather than one-off executions, and while AWS EventBridge is an option, it involves a lot of setup with events and Lambdas. I could schedule a Bash command locally, but that would mean keeping my laptop running and connected, which isn't practical since I need to sign into my auth proxies every 12 hours. Has anyone solved similar scheduling issues? What solutions do you recommend?

5 Answers

Answered By TechGuru99 On

Do you have any servers or VMs available where you could set up a cron job? I actually think AWS EventBridge isn't a bad option, especially if you're already in the AWS ecosystem—setting it up for basic tasks in Lambda can be pretty straightforward.

Answered By DevOpsDude88 On

I get that scheduling in GitLab can be tricky. Even though you can set a recurring job, there's a workaround where you could schedule it periodically and check the execution year at the start of your script. You can set it up to run every December 5 at 8 AM, for instance, and then just have the script exit if the year isn't 2025. Just be sure to delete the job afterward.

Answered By BusyDev12 On

Another option is using Azure Service Bus with scheduled messages for similar scenarios. It can effectively manage timing for tasks like yours.

Answered By CloudNinja44 On

If you're looking for a simple solution, have you considered using the `at` command? That would allow you to schedule tasks without too much hassle.

Answered By ScriptMaster007 On

Jenkins might be a great fit for your needs! It can easily handle one-off jobs and you can configure it to run at any specified time.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.