Answer the question
In order to leave comments, you need to log in
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
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.
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?
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question