Skip to content

Commit

Permalink
Scheduler crontab fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Feb 21, 2023
1 parent 44d94c6 commit 27ed1e6
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 113 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN apt update

# Install dependencies
RUN apt-get update -y && apt-get upgrade -y \
&& apt install -y --no-install-recommends dos2unix bash-completion lsof cron rsync ca-certificates apt-transport-https software-properties-common curl \
&& apt install -y --no-install-recommends dos2unix bash-completion lsof rsyslog cron rsync ca-certificates apt-transport-https software-properties-common curl \
&& curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
&& chmod a+rx /usr/local/bin/yt-dlp \
&& apt install -y --no-install-recommends sshpass nano net-tools curl apache2 php8.1 libapache2-mod-php8.1 php8.1-mysql php8.1-sqlite3 php8.1-curl php8.1-gd php8.1-intl \
Expand Down Expand Up @@ -70,7 +70,11 @@ RUN mkdir ~/build \
COPY deploy/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf

COPY deploy/crontab /etc/cron.d/crontab
RUN dos2unix /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab
RUN chmod +x /etc/cron.d/crontab
RUN service cron start
RUN crontab /etc/cron.d/crontab

# Configure AVideo
RUN dos2unix /usr/local/bin/docker-entrypoint && \
Expand Down
6 changes: 3 additions & 3 deletions deploy/crontab
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# m h dom mon dow command
1 1 * * * pip3 install --upgrade youtube-dl
* * * * * php /var/www/html/AVideo/plugin/Scheduler/run.php
#2 1 * * * php /var/www/html/AVideo/plugin/CDN/tools/moveMissingFiles.php
1 1 * * * pip3 install --upgrade youtube-dl > /proc/1/fd/1 2>/proc/1/fd/2
* * * * * php /var/www/html/AVideo/plugin/Scheduler/run.php > /proc/1/fd/1 2>/proc/1/fd/2
#2 1 * * * php /var/www/html/AVideo/plugin/CDN/tools/moveMissingFiles.php > /proc/1/fd/1 2>/proc/1/fd/2
8 changes: 6 additions & 2 deletions deploy/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,14 @@ chmod 777 /var/www/html/AVideo/videos/avideo.log
echo "deny access to .compose"
echo "Deny from all" > /var/www/html/AVideo/.compose/.htaccess

cd /var/www/html/AVideo/install && php updatedb.php
cd /var/www/html/AVideo/Encoder/install && php reencodeAllVideos.php

echo "crontab starting"
cron

apache2-foreground
echo "apache2-foreground done"

cd /var/www/html/AVideo/install && php updatedb.php && installPluginsTables.php 4
cd /var/www/html/AVideo/Encoder/install && php reencodeAllVideos.php

#eof
2 changes: 1 addition & 1 deletion objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4592,7 +4592,7 @@ function remove_utf8_bom($text) {
function getCacheDir() {
$p = AVideoPlugin::loadPlugin("Cache");
if (empty($p)) {
return addLastSlash(sys_get_temp_dir());
return addLastSlash(_sys_get_temp_dir());
}
return $p->getCacheDir();
}
Expand Down
8 changes: 0 additions & 8 deletions plugin/Scheduler/Objects/Scheduler_commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ public static function getAllScheduledTORepeat() {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
Expand All @@ -112,8 +110,6 @@ public static function getAllActiveAndReady() {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
Expand Down Expand Up @@ -329,8 +325,6 @@ public static function getAllFromType($type) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
Expand All @@ -355,8 +349,6 @@ public static function getAllActiveOrToRepeat($type='') {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
Expand Down
Loading

0 comments on commit 27ed1e6

Please sign in to comment.