No need to follow this issue up. In the meantime a rubberducky handed me this solution: https://gist.github.com/revis0r/28c979060a430c62c735
Met vriendelijke groet, Kind regards, Cordialement, Bastiaan Carels From: Carels, L.B. (Bastiaan) Sent: Tuesday, September 3, 2019 8:36 PM To: [email protected] Subject: Init.d script to start syncronisation at reboot - bucardo active, but not no automatic synchronization at reboot We have a test set up active for some time (RHEL 6, Bucardo 5.5.0, PG 9.6), but cannot automatically restart the synchronization at server reboot. Where can I find examples of an initd script, that starts synchronization [bucardo start -U user -P password] when the script is called with argument start (same for arguments stop/restart/status)? Thanks! Note: my script attempts cannot handle the postgres user & password arguments: no such file or #!/bin/sh ### BEGIN INIT INFO # Provides: Bucardo # Location: /etc/init.d/ [remove extension] # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. # Based on : https://github.com/fhd/init-script-template ### END INIT INFO dir="/usr/local/bin" cmd="/usr/local/bin/bucardo $1 -U postgres -P xxxxx" user="" name="bucardo" pid_file="/var/run/bucardo/$name.mcp.pid" stdout_log="/var/log/$name.log" stderr_log="/var/log/$name.err" get_pid() { cat "$pid_file" } is_running() { [ -f "$pid_file" ] && ps -p `get_pid` > /dev/null 2>&1 } case "$1" in start) if is_running; then echo "Already started" else echo "Starting $name" cd "$dir" if [ -z "$user" ]; then sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & else sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & fi echo $! > "$pid_file" if ! is_running; then echo "Unable to start, see $stdout_log and $stderr_log" exit 1 fi fi ;; stop) if is_running; then echo -n "Stopping $name.." kill `get_pid` for i in 1 2 3 4 5 6 7 8 9 10 # for i in `seq 10` do if ! is_running; then break fi echo -n "." sleep 1 done echo if is_running; then echo "Not stopped; may still be shutting down or shutdown may have failed" exit 1 else echo "Stopped" if [ -f "$pid_file" ]; then rm "$pid_file" fi fi else echo "Not running" fi ;; restart) $0 stop if is_running; then echo "Unable to stop, will not attempt to start" exit 1 fi $0 start ;; status) if is_running; then echo "Running" else echo "Stopped" exit 1 fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac exit 0 Met vriendelijke groet, Kind regards, Cordialement, Bastiaan Carels ----------------------------------------------------------------- ATTENTION: The information in this e-mail is confidential and only meant for the intended recipient. If you are not the intended recipient, don't use or disclose it in any way. Please let the sender know and delete the message immediately. -----------------------------------------------------------------
_______________________________________________ Bucardo-general mailing list [email protected] https://bucardo.org/mailman/listinfo/bucardo-general
