Hello,
Thank you for your response.
0. Here is an example of what I intended.
What I intended is to add pre-check tasks before executing pg_ctl start, stop, and restart using the -A and -Z options.
=========================================
[test@test]$ cat true.sh
#!/bin/bash
echo 'true'
exit 0
=========================================
[test@test]$ cat false.sh
#!/bin/bash
echo 'false'
exit 1
=========================================
[test@test]$ pg_ctl start -A false.sh
false
pg_ctl: pre-check for start failed, aborting start
=========================================
[test@test]$ pg_ctl start -A true.sh
true
waiting for server to start....2024-07-19 00:16:22.768 UTC [167505] LOG: starting PostgreSQL 18devel on
~
~
done
server started
=========================================
[test@test]$ pg_ctl stop -Z false.sh
false
pg_ctl: pre-check for stop failed, aborting stop
=========================================
[test@test]$ pg_ctl stop -Z true.sh
true
waiting for server to shut down....2024-07-19 00:21:06.282 UTC [167515] LOG: received fast shutdown request
~
~
done
server stopped
=========================================
[test@test]$ pg_ctl restart -A false.sh -Z false.sh
false
pg_ctl: pre-check script for stop failed, aborting stop
=========================================
[test@test]$ pg_ctl restart -A false.sh -Z true.sh
true
waiting for server to shut down...2024-07-19 00:24:39.640 UTC [167530] LOG: received fast shutdown request
~
~
done
server stopped
false
pg_ctl: pre-check script for start failed, aborting start
=========================================
1. I plan to change it to chmod_recursive() instead of using chmod itself.
2. I will modify it to use 4 spaces instead of a tab.
Thank you,
Myoungjun Kim