vm icon indicating copy to clipboard operation
vm copied to clipboard

Make the `files_inotify` a script instead

Open enoch85 opened this issue 3 years ago • 8 comments

Seems like the reboot option isn't working in the crontab created to run files_inotify job.

Running it manually works, but it doesn't seem to work when a reboot is made. So I think it would be better to run it in a script on a time schedule instead. For example once per day, or every 10 minutes.

What needs to be done:

  1. pgrep to check if the job is already running. If not, run it in a nohup
  2. Update all the current cronjobs, to call the script instead of the cronjob itself with the update script)

@szaimen Since it's your contribution, do you think you could have a look at it?

Thanks! :bowing_man:

enoch85 avatar Jun 25 '22 08:06 enoch85

Are you sure that the @reboot option is really the problem here? if yes, probably no cronjob that uses this is working right now...

szaimen avatar Jun 25 '22 11:06 szaimen

Running it manually works, but it doesn't seem to work when a reboot is made. So I think it would be better to run it in a script on a time schedule instead. For example once per day, or every 10 minutes.

this is not possible as it need to run in the background at all time to be able to watch the changes. Hence the reboot option was chosen...

szaimen avatar Jun 25 '22 11:06 szaimen

Question came up since a customer which didn't have inotify enabled had issues with SMB. So I added it manually by running everything from the script step by step.

After a reboot I pgrepped for inotify but it didn't show up - until I ran it manually, then it worked.

So all we need to do really is start it one time, and that can be done by a script which executes the nohup option in case pgrep for inotify is false.

enoch85 avatar Jun 25 '22 12:06 enoch85

So all we need to do really is start it one time, and that can be done by a script which executes the nohup option in case pgrep for inotify is false.

Hm, so maybe simply but the lines in a separate script then? However the cronjob is needed because it needs to be started again after a reboot...

szaimen avatar Jun 25 '22 14:06 szaimen

Yes, something like that. If you start with a PR I can fix the details.

  1. Move the crontab command to a separate script. Don't forget to check with pgrep for the running session
  2. Run the script from the crontab
  3. Update all the old crontabs to this new one; remove the old, ad the new.

enoch85 avatar Jun 25 '22 21:06 enoch85

@szaimen Do you have time for this?

enoch85 avatar Aug 27 '22 21:08 enoch85

I fear not really. However will have a look anyway.

szaimen avatar Aug 30 '22 12:08 szaimen

Made a WIP in https://github.com/nextcloud/vm/pull/2391. However not sure how to continue since I still don't get the usecase...

Can you take over @enoch85 ?

szaimen avatar Aug 30 '22 13:08 szaimen