From d8a6aa04a9599bca5e1f79dac79fa5e01b9b9be5 Mon Sep 17 00:00:00 2001 From: Bogdan Grosu Date: Sun, 3 Mar 2024 12:33:01 +0000 Subject: [PATCH] feat(iptvboss): adding last cron changes --- .gitignore | 12 +++++++----- Dockerfile | 34 +++++++++++++++++----------------- docker-compose.yaml | 1 - entrypoint.sh | 5 +++++ iptvboss-cron | 3 ++- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 45fce1d..74b15a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ +iptvboss/* +.venv/* .vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets +.vscode/settings.json +.vscode/tasks.json +.vscode/launch.json +.vscode/extensions.json +.vscode/*.code-snippets # Local History for Visual Studio Code .history/ diff --git a/Dockerfile b/Dockerfile index d0e960d..691a58b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Use the official CentOS base image -FROM consol/rocky-xfce-vnc +FROM consol/debian-xfce-vnc # Set locale to avoid warnings ENV LC_ALL=C.UTF-8 @@ -8,28 +8,31 @@ ENV LC_ALL=C.UTF-8 # Switch to root temporarily to perform system updates USER 0 -# Install necessary dependencies -RUN yum install -y wget cronie vlc \ - && yum update -y \ - && yum clean all +# Set the working directory +WORKDIR /headless -# Create a new user with home directory set to /headless -RUN useradd -m -d /headless -s /bin/bash iptvboss +# Update package list and upgrade installed packages +RUN apt-get update && apt-get upgrade -y + +# Install necessary dependencies +RUN apt-get install --no-install-recommends wget cron curl sudo vlc -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* # Install Cronitor by default RUN curl https://cronitor.io/install-linux?sudo=1 | sh -# Set the working directory -WORKDIR /headless +# Create a new user with home directory set to /he adless +RUN useradd -m -d /headless -s /bin/bash iptvboss # Copy the cron file to the cron.d directory -COPY iptvboss-cron /var/spool/crontab/iptvboss/iptvboss-cron +COPY iptvboss-cron /etc/cron.d/iptvboss-cron # Give execution rights on the cron job -RUN chmod 0644 /var/spool/crontab/iptvboss/iptvboss-cron - -# Create the log file to be able to run tail -RUN touch /var/log/cron.log +RUN crontab -u iptvboss /etc/cron.d/iptvboss-cron && \ + chmod u+s /usr/sbin/cron && \ + touch /var/log/cron.log && \ + chown iptvboss:iptvboss /var/log/cron.log # Download and extract iptvboss tar RUN wget "https://github.com/walrusone/iptvboss-release/releases/latest/download/iptvboss-3.4.160.0-linux-amd64.tar.gz" && \ @@ -45,9 +48,6 @@ ENV PATH="/usr/lib/iptvboss/bin:${PATH}" # Switch back to the non-root user USER 1000 -# Apply cron job -RUN crontab /var/spool/crontab/iptvboss/iptvboss-cron - # Expose VNC port EXPOSE 5901 EXPOSE 6901 diff --git a/docker-compose.yaml b/docker-compose.yaml index be96b93..a2fddbb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,6 @@ services: dockerfile: Dockerfile container_name: iptvboss environment: - - CRONITOR_ENABLE=true - CRONITOR_API_KEY=7151dcaa743f43e3b5f3c64fb4649dd9 networks: - portainer_network diff --git a/entrypoint.sh b/entrypoint.sh index c8c6ece..122fa19 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,5 +6,10 @@ else echo "CRONITOR_API_KEY not set. Please make sure it is defined." fi +echo "Start cron" +cron & +echo "cron started" + +echo "Start vnc" /dockerstartup/vnc_startup.sh --wait ``` diff --git a/iptvboss-cron b/iptvboss-cron index 3b5f4af..06a51ee 100644 --- a/iptvboss-cron +++ b/iptvboss-cron @@ -1 +1,2 @@ -0 04-17/12 * * * /usr/lib/iptvboss/bin/iptvboss -nogui +0 04-17/12 * * * /usr/lib/iptvboss/bin/iptvboss -nogui >> /var/log/cron.log 2>&1 +0 * * * * echo "Hello World" >> /var/log/cron.log 2>&1