mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-22 17:06:29 +00:00
Add systemd service (#540)
This commit is contained in:
16
pgcat.service
Normal file
16
pgcat.service
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=PgCat pooler
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
User=pgcat
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
Environment=RUST_LOG=info
|
||||
LimitNOFILE=65536
|
||||
ExecStart=/usr/bin/pgcat /etc/pgcat.toml
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
4
postinst
Normal file
4
postinst
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable pgcat
|
||||
4
prerm
Normal file
4
prerm
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl stop pgcat
|
||||
systemctl disable pgcat
|
||||
@@ -17,14 +17,21 @@ cargo build --release
|
||||
rm -rf "$deb_dir"
|
||||
mkdir -p "$deb_dir/DEBIAN"
|
||||
mkdir -p "$deb_dir/usr/bin"
|
||||
mkdir -p "$deb_dir/etc"
|
||||
mkdir -p "$deb_dir/etc/systemd/system"
|
||||
|
||||
cp target/release/pgcat "$deb_dir/usr/bin/pgcat"
|
||||
chmod +x "$deb_dir/usr/bin/pgcat"
|
||||
|
||||
cp pgcat.toml "$deb_dir/etc/pgcat.toml"
|
||||
cp pgcat.service "$deb_dir/etc/systemd/system/pgcat.service"
|
||||
|
||||
(cat control | envsubst) > "$deb_dir/DEBIAN/control"
|
||||
cp postinst "$deb_dir/DEBIAN/postinst"
|
||||
cp postrm "$deb_dir/DEBIAN/postrm"
|
||||
cp prerm "$deb_dir/DEBIAN/prerm"
|
||||
|
||||
chmod +x ${deb_dir}/DEBIAN/post*
|
||||
chmod +x ${deb_dir}/DEBIAN/pre*
|
||||
|
||||
dpkg-deb \
|
||||
--root-owner-group \
|
||||
|
||||
Reference in New Issue
Block a user