Skip to content

Commit

Permalink
deb/rpm service changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulguptajss authored and cgrinds committed May 17, 2021
1 parent 962f36a commit 03aa5fd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
3 changes: 0 additions & 3 deletions deb/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ if [ ! -e /opt/harvest/harvest.yml ]; then
cp /opt/harvest/harvest.example.yml /opt/harvest/harvest.yml
echo " --> use default config file [/opt/harvest/harvest.yml]"
fi
if [ ! -e /usr/bin/harvest ]; then
ln -s /opt/harvest/bin/harvest /usr/bin/harvest && echo " --> link created"
fi
systemctl daemon-reload
systemctl start harvest.service
systemctl enable harvest.service
Expand Down
3 changes: 3 additions & 0 deletions deb/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ if [[ "$1" == "install" || "$1" == "upgrade" ]]; then
if systemctl list-units --full -all | grep -Fq 'harvest.service'; then
systemctl stop harvest && echo "stopped harvest ..."
fi
if [ -e /usr/bin/harvest ]; then
unlink /usr/bin/harvest && echo " --> delete link"
fi
getent group harvest > /dev/null 2>&1 || addgroup -q --system harvest && echo " --> group created"
getent passwd harvest > /dev/null 2>&1 || adduser -q --system --no-create-home \
--ingroup harvest --disabled-password --shell /bin/false harvest && echo " --> user created"
Expand Down
12 changes: 5 additions & 7 deletions rpm/spec
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ cp $RPM_BUILD_ROOT/opt/harvest/service/harvest.service /etc/systemd/system/
chmod 664 /etc/systemd/system/harvest.service

# remove link from previous version, use /usr/bin to conform to linux fhs
if [ -e /usr/local/bin/harvest ]; then
unlink /usr/local/bin/harvest
fi
if [ ! -e /usr/bin/harvest ]; then
ln -s /opt/harvest/bin/harvest /usr/bin/harvest
echo " --> create link"
if [ -e /usr/bin/harvest ]; then
unlink /usr/bin/harvest
fi
systemctl daemon-reload
systemctl start harvest.service
Expand All @@ -85,7 +81,9 @@ fi
if [ $1 = 0 ]; then
userdel harvest && echo " --> delete harvest user"
groupdel harvest && echo " --> delete harvest group"
unlink /usr/bin/harvest && echo " --> delete link"
if [ -e /usr/bin/harvest ]; then
unlink /usr/bin/harvest && echo " --> delete link"
fi
rm -rf /var/run/harvest && echo " --> delete pid folder"
echo " --> removing systemctl harvest files "
systemctl disable harvest.service
Expand Down
4 changes: 2 additions & 2 deletions service/harvest.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ After=network-online.target
User=harvest
Group=harvest
WorkingDirectory=/opt/harvest
ExecStart=/usr/bin/harvest \
start \
ExecStart=/opt/harvest/bin/harvest \
restart \
--config /opt/harvest/harvest.yml
IgnoreSIGPIPE=no
KillMode=process
Expand Down

0 comments on commit 03aa5fd

Please sign in to comment.