Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crontab for everyone using iNotify #2421

Open
enoch85 opened this issue Dec 27, 2022 · 1 comment
Open

Update crontab for everyone using iNotify #2421

enoch85 opened this issue Dec 27, 2022 · 1 comment

Comments

@enoch85
Copy link
Member

enoch85 commented Dec 27, 2022

This piece of code would update the crontab for everyone using the SMB mount app. Problem is that it's not fail proof to get the actual MOUNT_IDs so it's better to do it manually.

source /var/scripts/fetch_lib.sh

# Replace iNotify checker with a script instead
if crontab -u www-data -l | grep -q "files_external:notify -v"
then
    download_script ADDONS notify-crontab
    chmod +x "$SCRIPTS"/notify-crontab.sh
    chown root:root "$SCRIPTS"/notify-crontab.sh
    MOUNT_ID=$(sudo -u postgres psql nextcloud_db -c "select mount_id from oc_external_config")
    crontab -u www-data -l | grep -v "files_external:notify -v" | crontab -u www-data -
    crontab -u root -l | { cat; echo "@reboot $SCRIPTS/notify-crontab.sh $(echo "${MOUNT_ID##*  }" | head -1)"; } | crontab -u root -
    print_text_in_color "$ICyan" "Replaced  iNotify with a script instead of command."
fi
@enoch85
Copy link
Member Author

enoch85 commented Apr 14, 2023

tested and works on a customers instance, but it only added the last mount_id. Maybe a for loop would work here? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant