Media_Automation/startup.sh

35 lines
1.2 KiB
Bash
Raw Normal View History

2017-11-27 04:07:09 +00:00
#!/bin/bash
#Check for a user password. If non, then set password to newpassword
if [ -z "$PASSWORD" ]; then
echo "Setting default SSH password to newpassword"
echo "zepheris:newpassword" | chpasswd
else
echo "SSH Password is $PASSWORD"
echo "zepheris:$PASSWORD" | chpasswd
fi
chown zepheris:users -R /config/
chown root:root /config/cron/cron_get
if [ ! -d /home/zepheris/.filebot ]; then setuser zepheris ln -s /config/.filebot /home/zepheris/.filebot; fi
if [ ! -d /home/zepheris/.flexget ]; then setuser zepheris ln -s /config/.flexget /home/zepheris/.flexget; fi
if [ ! -d /home/zepheris/.ssh ]; then setuser zepheris ln -s /config/.ssh /home/zepheris/.ssh; fi
if [ ! -d /home/zepheris/.gitconfig ]; then setuser zepheris ln -s /config/.gitconfig /home/zepheris/.gitconfig; fi
if [ ! -d /home/zepheris/.bashrc ]; then setuser zepheris ln -s /config/.bashrc /home/zepheris/.bashrc; fi
if [ ! -f /etc/cron.d/cron_get ]; then ln -s /config/cron/cron_get /etc/cron.d/cron_get; fi
#function to stop services and exit the container
_term() {
echo "Caught SIGTERM Signal"
echo "Stopping all services"
service shellinabox stop
exit 0
}
trap 'kill ${!}; _term' SIGTERM
echo -e "Starting Web SSH"
service shellinabox start