Update paperless-ngx-update.sh

This commit is contained in:
tteckster 2022-11-29 12:02:29 -05:00 committed by GitHub
parent e3ebc43ae6
commit 165ea5897b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 4 deletions

View File

@ -38,8 +38,7 @@ cat <<"EOF"
/_/ \__,_/ .___/\___/_/ /_/\___/____/____/ /_/ /_/\__, /_/|_| /_/ \__,_/ .___/\___/_/ /_/\___/____/____/ /_/ /_/\__, /_/|_|
/_/ UPDATE /____/ /_/ UPDATE /____/
EOF EOF
echo -e "🚨 This will break Paperless-ngx DO NOT UPGRADE to version 1.10.0"
echo -e "Working on a solution"
while true; do while true; do
read -p "This will Update Paperless-ngx to $RELEASE. Proceed(y/n)?" yn read -p "This will Update Paperless-ngx to $RELEASE. Proceed(y/n)?" yn
case $yn in case $yn in
@ -50,7 +49,7 @@ while true; do
done done
sleep 2 sleep 2
msg_info "Stopping Paperless-ngx" msg_info "Stopping Paperless-ngx"
systemctl stop paperless-consumer paperless-webserver paperless-scheduler systemctl stop paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service
sleep 1 sleep 1
msg_ok "Stopped Paperless-ngx" msg_ok "Stopped Paperless-ngx"
@ -64,6 +63,33 @@ sed -i -e 's|-e git+https://github.com/paperless-ngx/django-q.git|git+https://gi
pip install -r requirements.txt &>/dev/null pip install -r requirements.txt &>/dev/null
cd /opt/paperless/src cd /opt/paperless/src
/usr/bin/python3 manage.py migrate &>/dev/null /usr/bin/python3 manage.py migrate &>/dev/null
SER=/etc/systemd/system/paperless-task-queue.service
if [ -f "$SER" ]; then
msg_ok "paperless-task-queue.service Exists."
else
cat <<EOF >/etc/systemd/system/paperless-task-queue.service
[Unit]
Description=Paperless Celery Workers
Requires=redis.service
[Service]
WorkingDirectory=/opt/paperless/src
ExecStart=celery --app paperless worker --loglevel INFO
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now paperless-task-queue
msg_ok "paperless-task-queue.service Created."
fi
cat <<EOF >/etc/systemd/system/paperless-scheduler.service
[Unit]
Description=Paperless Celery beat
Requires=redis.service
[Service]
WorkingDirectory=/opt/paperless/src
ExecStart=celery --app paperless beat --loglevel INFO
[Install]
WantedBy=multi-user.target
EOF
msg_ok "Updated to ${RELEASE}" msg_ok "Updated to ${RELEASE}"
msg_info "Cleaning up" msg_info "Cleaning up"
@ -73,7 +99,7 @@ rm -rf paperless-ngx
msg_ok "Cleaned" msg_ok "Cleaned"
msg_info "Starting Paperless-ngx" msg_info "Starting Paperless-ngx"
systemctl start paperless-consumer paperless-webserver paperless-scheduler systemctl start paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service
sleep 1 sleep 1
msg_ok "Finished Update" msg_ok "Finished Update"
echo -e "\n${BL}It may take a minute or so for Paperless-ngx to become available.${CL}\n" echo -e "\n${BL}It may take a minute or so for Paperless-ngx to become available.${CL}\n"