38 lines
788 B
Bash
38 lines
788 B
Bash
startup_check() {
|
|
|
|
if [[ -z "$(ls /volumes)" ]]; then
|
|
echo "Nothing in /volumes"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -e "/.env" ]]; then
|
|
echo Missing .env file
|
|
exit 1
|
|
else
|
|
source /.env
|
|
if [[ -z "$NAME" ]]; then
|
|
echo Missing NAME in .env
|
|
exit 1
|
|
fi
|
|
if [[ -z "$HOST" ]]; then
|
|
echo Missing HOST in .env
|
|
exit 1
|
|
fi
|
|
if [[ ! -e "~/.ssh/known_hosts" ]]; then
|
|
echo "Running ssh keyscan"
|
|
mkdir -p ~/.ssh
|
|
ssh-keyscan $HOST > ~/.ssh/known_hosts
|
|
fi
|
|
fi
|
|
|
|
if [[ ! -e "/id" ]]; then
|
|
echo Missing ssh identity file
|
|
exit 1
|
|
fi
|
|
|
|
echo Startup check passed
|
|
}
|
|
|
|
startup_check
|
|
/usr/sbin/cron &
|
|
sleep infinity |