Explorar o código

Merge branch 'feature/cron' into 'master'

add cron feature

See merge request !1

Girish Ramakrishnan %!s(int64=8) %!d(string=hai) anos
pai
achega
290c5264c9
Modificáronse 4 ficheiros con 27 adicións e 0 borrados
  1. 1 0
      Dockerfile
  2. 10 0
      index.php
  3. 5 0
      start.sh
  4. 11 0
      supervisor/cron.conf

+ 1 - 0
Dockerfile

@@ -38,6 +38,7 @@ RUN apt-get update && apt-get install -y php libapache2-mod-php crudini \
     php-yac \
     php-zip \
     proftpd proftpd-mod-ldap \
+    cron \
     && rm -rf /var/cache/apt /var/lib/apt/lists /etc/ssh_host_*
 
 # configure apache

+ 10 - 0
index.php

@@ -84,6 +84,16 @@ sftp -P 2222 surfer.nebulon.info:public/
 
 <br/>
 
+<h2>Cron</h2>
+<p>
+  Just put a file called crontab to the directory /app/data and it will picked up at next app restart. It has to be in the cron syntax without username.
+</p>
+<p>
+  Commands are executed as the user www-data. See <a href="https://linux.die.net/man/5/crontab">manpage</a> for a description of the file.
+</p>
+
+<br/>
+
 <h2>Logs</h2>
 <p>Apache logs can be viewed using the <a href="https://cloudron.io/references/cli.html" target="_blank">cloudron commandline tool</a>.</p>
 <pre>

+ 5 - 0
start.sh

@@ -70,6 +70,11 @@ if [ -f "/app/data/run.sh" ]; then
     /bin/bash /app/data/run.sh
 fi
 
+## configure in-container Crontab
+if [ -f "/app/data/crontab" ]; then
+  crontab -u www-data /app/data/crontab
+fi
+
 chown -R www-data:www-data /app/data /run/apache2 /run/proftpd /run/app
 
 echo "Starting supervisord"

+ 11 - 0
supervisor/cron.conf

@@ -0,0 +1,11 @@
+[program:cron]
+directory=/
+command=/usr/sbin/cron -f -L 15
+user=root
+autostart=true
+autorestart=true
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0
+stderr_logfile=/dev/stderr
+stderr_logfile_maxbytes=0
+