Can't Tell
Can't Tell

Reputation: 13426

Does inotify trigger the IN_DELETE before or after deletion?

I'm trying to backup a file before it gets deleted. Can someone tell me if inotify triggers the event before or after deletion?

Upvotes: 0

Views: 734

Answers (2)

patrick L
patrick L

Reputation: 1

but is'it possible to make inotify trigger before each action.

rm -rf /media/disqueExterne/ and inotify send an alert as do a database server before each access to a record..

here :

[bash command rm -rf /media/disqueExterne ] ---> [system pipe ] ---> direct order ---> [/dev/sdd1 ] ---> files destroyeds

with inotify pretrigger

[bash command rm -rf /media/disqueExterne ] ---> [ system pipe] --> [inotify pretrigger catch ] ---> backup each file ---> securised rm -rf order ---> [/dev/sdd1 ] ---> files destroyeds is it possible to catch the commands in a system pipe or buffer before sending the order.

[user send a command ] ---> [buffer] ---> order [ action launched] and after

[user send a command ] ---> // inotify hold data ---> [inotify action] --- // --> [return to buffer ] ---> order ---> [action launched ]

Upvotes: 0

Cédric Julien
Cédric Julien

Reputation: 80761

The IN_DELETE is triggered when a file/directory is deleted in the watched directory, ie after the deletion.

Upvotes: 4

Related Questions