diff options
Diffstat (limited to 'run.sh')
-rwxr-xr-x | run.sh | 31 |
1 files changed, 22 insertions, 9 deletions
@@ -25,9 +25,9 @@ # This is the file called from the /usr/bin/swish-cplint symlink pkg_dir="/usr/share/swish-cplint" -pid_file="/run/swish-cplint.pid" -installed_file="/home/swish/installed" -deps_installer="/home/swish/install_web_iface_deps.pl" +pid_file="/run/swish-cplint/swish-cplint.pid" +installed_file=""$pkg_dir"/installed" +deps_installer=""$pkg_dir"/install_web_iface_deps.pl" user="swish" group="swish" @@ -62,7 +62,8 @@ initialize() printf "This may take a while.\n" $deps_installer if [ $? -eq 0 ]; then - echo "true" > "$installed_file" + echo "# Don't touch this file" > "$installed_file" + echo "true" >> "$installed_file" else printf "Install web dependencies error\n" exit 1 @@ -70,6 +71,18 @@ initialize() fi } +killd() +{ + # kill action only if process exists. + if [ -f "$pid_file" ]; then + pid=$(cat "$pid_file") + ps -q $pid > /dev/null + if [ $? -eq 0 ]; then + kill -s TERM $pid + fi + fi +} + startd() { local pid="" @@ -87,20 +100,20 @@ startd() # # Copyright (C) 2016 frnmst (Franco Masotti) <franco.masotti@student.unife.it> # -# This file is part of cplint-installer. +# This file is part of swish-installer. # -# cplint-installer is free software: you can redistribute it and/or modify +# swish-installer is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# cplint-installer is distributed in the hope that it will be useful, +# swish-installer is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with cplint-installer. If not, see <http://www.gnu.org/licenses/>. +# along with swish-installer. If not, see <http://www.gnu.org/licenses/>. # # @@ -137,7 +150,7 @@ killd() pid=$(cat "$pid_file") ps -q $pid > /dev/null if [ $? -eq 0 ]; then - kill -s SIGTERM $pid + kill -s TERM $pid fi fi } |