Skip to content

Commit

Permalink
完善安装脚本,支持 opensuse 15 和 centos 6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
hpq committed Sep 4, 2018
1 parent 10d0778 commit a6ef735
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ get_init_type() {
if [ "$comm" = "systemd" ]; then
INIT_TYPE="systemd"
return
elif [ $comm = "init" ]; then
elif [ "$comm" = "init" ]; then
ver=$(/sbin/init --version 2>/dev/null | grep upstart)
if [ -n $ver ]; then
INIT_TYPE="upstart"
Expand All @@ -25,8 +25,15 @@ install() {
case $INIT_TYPE in
"systemd" )
echo install in systemd init
cp $SCRIPTS_ROOT/systemd/sysmon.service /lib/systemd/system/
sed -i "s|APP_PATH|$APP_PATH|g" /lib/systemd/system/sysmon.service
if [ -d /usr/lib/systemd/system ]; then
dst_path="/usr/lib/systemd/system"
elif [ -d /lib/systemd/system ]; then
dst_path="/lib/systemd/system"
else
dst_path="/etc/systemd/system"
fi
cp $SCRIPTS_ROOT/systemd/sysmon.service $dst_path/
sed -i "s|APP_PATH|$APP_PATH|g" $dst_path/sysmon.service
systemctl daemon-reload
systemctl enable sysmon
systemctl start sysmon
Expand Down Expand Up @@ -56,6 +63,7 @@ uninstall() {
systemctl daemon-reload
;;
"upstart" )
rm -rvf /etc/init/sysmon.conf
echo uninstall sysmon from upstart init
;;
"sysvinit" )
Expand Down

0 comments on commit a6ef735

Please sign in to comment.