Skip to content

Update crontab for everyone using iNotify #2421

@enoch85

Description

@enoch85

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions