4
Fork 0
CronosAgent/debian/postinst

32 lines
730 B
Bash
Executable file

#!/bin/bash
PREFIX=/opt/CronosAgent
grep master /etc/passwd > /dev/null
if [ "$?" == "1" ]
then
addgroup cronos
adduser cronos --system --home $PREFIX --shell /bin/false --disabled-login --disabled-password
fi
ps -eaf | grep root | grep systemd > /dev/null
if [ "$?" == "0" ]
then
ln -s -f $PREFIX/cronosagent.service /etc/systemd/system/multi-user.target.wants/cronosagent.service
systemctl daemon-reload
systemctl restart cronosagent
else
ln -s -f $PREFIX/cronosagent-init /etc/init.d/cronosagent
update-rc.d cronosagent defaults
service cronosagent restart
if [ -d /etc/monit/conf.d ]
then
ln -s -f $PREFIX/cronosagent-monit /etc/monit/conf.d/cronosagent
service monit restart
fi
fi
exit 0