toluaina / pgsync

Postgres to Elasticsearch/OpenSearch sync
https://pgsync.com
MIT License
1.1k stars 172 forks source link

how to start pgsync work in the background? #496

Closed Barolina closed 8 months ago

Barolina commented 9 months ago

Please,

do I need to write the -d command to systemd? right?

kirubakaran commented 8 months ago

@Barolina Not sure if this is what you're looking for, but fwiw, here is my setup:

sudo vim /etc/systemd/system/pgsync.service
[Unit]
Description=pgsync daemon
After=network.target

[Service]
WorkingDirectory=/home/xxxx/pgsync
ExecStart=/home/xxxx/pgsync/env/bin/pgsync --daemon
User=xxxx
Restart=always
RestartSec=10
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target

Then:

sudo systemctl daemon-reload
sudo systemctl enable pgsync
sudo systemctl start pgsync
sudo systemctl status pgsync

You can follow the output of pgsync with:

sudo journalctl -u pgsync -f
Barolina commented 8 months ago

Thank you