setup/clone/utility/sats-loop

40 lines
1021 B
Plaintext
Raw Normal View History

#!/bin/sh
2017-01-26 12:50:56 +00:00
# [0] Exit if no argument
test $# -lt 1 && exit;
# [1] first install (install source code)
if [ -e /home/sats/satsd/first_install ]; then
2017-01-26 12:50:56 +00:00
dpkg -s git 2>/dev/null >/dev/null && usegit=1 || usegit=0;
# install source code
if [ $usegit -eq 1 ]; then
git clone ssh://smmp-server/satsd/git /home/sats/satsd/source \
&& rm /home/sats/satsd/first_install \
|| exit;
else
# temporary replacement (without git)
scp -r smmp-server:/satsd/scp/source /home/sats/satsd/ \
&& rm /home/sats/satsd/first_install \
|| exit;
fi;
fi;
# [2] Propagate script
2017-01-26 12:50:56 +00:00
if [ "$1" = "daemon" ]; then
sh /home/sats/satsd/source/daemon $* 2>> /home/sats/satsd/log/daemon.log >> /home/sats/satsd/log/daemon.log;
elif [ "$1" = "update" ]; then
sh /home/sats/satsd/source/update 2>> /home/sats/satsd/log/update.log >> /home/sats/satsd/log/update.log;
fi;