I was trying to add CRON jobs and found no guide. So here are the steps I followed
mkdir cron && cd cronCreates directory and change into it.git initNew git initialization.touch captain-definitionCreates new captain config file.- In captain-definition add folowing code. It'll loads jobber image which works fine even if deprecated. We just need it to run a task in a schedule.
{
"schemaVersion": 2,
"dockerfileLines": [
"FROM jobber"
]
}or you can try
{
"schemaVersion": 2,
"templateId": "jobber"
}git add . && git commit -m 'New cron job for xxx'It'll add to git.caprover deployRun it to deploy as for other apps.
Everything deployed!
Now add tasks
- SSH into your server
docker container lsSee all running containers and copy ID of thecron(or what you named) container.docker exec -it <ID_HERE> shYou'll move into container.cd /home/jobberuser/ && vi .jobberWrite your task following guide here and save it.exitexits container and then rundocker restart <ID_HERE>to restart container.
We're all done.