Please tick the appropriate box to help us categorize your post
Bug or Error
Feature Request
Documentation Issue
Other
Hello everyone!
I’m working with Workbench AI and looking for help with automating the execution of a service. Specifically, I want to set up the “ollama serve” service to auto-start and run every minute.
I attempted to add ollama serve &
directly to the postBuild.bash
script, but it didn’t work as expected. My understanding of when and how the postBuild script runs is a bit unclear, so I’m wondering if there’s a simpler or more effective way to accomplish this task.
Here’s the part I’m using in my postBuild.bash
:
curl -fsSL https://ollama.com/install.sh | sh
sudo sh -c 'echo "#!/bin/bash\npgrep -f \"ollama serve\" > /dev/null || ollama serve &" > /tmp/ollama_cron.sh' && \
sudo chmod +x /tmp/ollama_cron.sh && \
(sudo crontab -l 2>/dev/null; echo "* * * * * /tmp/ollama_cron.sh") | sudo crontab -
If there’s a better way to handle this, or if I’m approaching it incorrectly, I’d greatly appreciate any suggestions. Sorry if this is a bit of a basic question—I’m still learning the process.
Thanks so much for your time and assistance!