Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CRON in Docker

Featured Replies

How do i enable a crontab job in a docker ?

 

I need to have my spotweb docker refresh every hour.. I can give the command manually from console..

 

In a VM I can do this , I can also do it in unraid itself, setting it up in the GO file, but I am unsure how to do this in a docker and having it survive a reboot.

7 hours ago, Helmonder said:

I can give the command manually from console

 

7 hours ago, Helmonder said:

I can also do it in unraid itself, setting it up in the GO file

Probably the best option, or via user scripts.  Any changes (adding a cronjob) within the image will get lost if/when the container gets updated

  • Author

But how though.. I can set a cron job to run through the go file for unraids own environment, but how do i do it for the environment of a docker ?

21 hours ago, Helmonder said:

But how though.. I can set a cron job to run through the go file for unraids own environment, but how do i do it for the environment of a docker ?

you would set up your script to be something like

docker exec -t NameOfContainer CommandToRun

 

  • Author

Thanks... Have to do a bit more digging... In my spotweb container there is no CRON present.. So I would have to make a script executed via the GO as follows:

 

apt-get update
apt-get -y install cron

 

Then something that puts the following line in cron from commandline:

 

@hourly /usr/bin/php /var/www/spotweb/spotweb/retrieve.php

 

Then I would have to make sure that the docker is running when the GO file is executed.. Possibly work with a pause in there..

 

  • 1 year later...

i have spotweb running in the "nginx" docker with the database on the "mariadb" docker. The "nginx" docker has cron buildin

 

Addad the following user script on unraid: Download "CA User Scripts" from CA. Go to Settings --> User Scripts --> ADD NEW SCRIPT. add a script name for example "update spotweb" click on the newly created user script named: update sportweb (blue text) and click "Edit Script" remove all text and paste this:

 

#!/bin/bash
docker exec -t nginx php /config/www/spotweb/retrieve.php > /dev/null

 

afbeelding.png.ac5bfae1ceb49b5cf7b0a47f8ac05ff2.png

/config/www/spotweb/retrieve.php is the path to the retrieve.php file from within the docker container.

 

Click SAVE CHANGES and set Schedule Disabled to Scheduled hourly

afbeelding.thumb.png.f05bc24ec88cb9daa1810011d53f1372.png

 

If you do this the script "update spotweb" (the cronjob) survives an update of the "nginx" docker.

 

Out of curiosity in what docker are you running spotweb ?

 

 

Edited by Dikkekop

  • 3 weeks later...
  • Author

That post was a blast from the past.. Things have been running for over a year.

 

At the moment I am using jgeusebroek/spotweb for spotweb. I was using the MySQL docker as a datebase but at some point it failed and I switched to the Postgres11 docker (postgres:11) which now works fine.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.