sudo apt-get install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev
wget https://www.python.org/ftp/python/3.12.5/Python-3.12.5.tgz
tar -xvf Python-3.12.5.tgz
cd Python-3.12.5
./configure --enable-optimizations --with-ensurepip=install
make -j $(nproc)
sudo make altinstall
sudo apt-get install redis-server
pip install rq
pip install rq-scheduler
rq worker --with-scheduler
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
source ~/.zshrc
from datetime import timedelta
from rq import Queue
from redis import Redis
from tasks import send_info
queue = Queue(name='default', connection=Redis())
queue.enqueue_in(timedelta(seconds=5), send_info, 1). # date time, func, args
[Unit]
Description=RQ Worker
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/customers/project/git
Environment=LANG=en_US.UTF-8
Environment=LC_ALL=en_US.UTF-8
Environment=LC_LANG=en_US.UTF-8
ExecStart=/opt/customers/project/bin/rq worker --with-scheduler
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
Restart=always
[Install]
WantedBy=multi-user.target
project - каталог в котором расположен /bin, в котором есть rq
git - каталог проекта в котором расположен файл .py из которого вызываются функции