K
K
Kizzeon2020-03-25 06:54:07
linux
Kizzeon, 2020-03-25 06:54:07

How should a cron script delete a file and execute a postgresql query look like?

I have a postgresql script that I need to run every day. But I need to execute it exactly after deleting the file, and not by a separate cron, and I can’t find it anywhere as a postgresql query with a Linux command to connect.

How can this be implemented?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vadim Priluzkiy, 2020-03-25
@Oxyd

Create a shell script where you first delete the file, then make a request. Give the script the right to execute and register its launch in cron.

G
Germanjon, 2020-03-25
@Germanjon

1. How is the file deleted (at a random time, depending on the situation, every day at the same time)?
2. Is deleting a file a trigger for running a script?
3. When and by whom is the decision to delete a file made?
4. Can a situation arise that the file cannot be deleted?

V
vlarkanov, 2020-03-25
@vlarkanov

rm filename & sudo -u postgres psql command

V
Victor Taran, 2020-03-25
@shambler81

5 0 * * * /bin/rm -f /hom/111.txt && /usr/bin/mysql -ubanstat -p'tffsdf3gfadsln.a;' dbrealty -e 'INSERT INTO calendar SET date = CURRENT_DATE()' >/dev/null 2>&1

well only for postgrey

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question