mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-16 10:48:47 +00:00
added a copying script and sudoers.d contribution to allow all users including sailing to copy the /root/mail.properties to server folders
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
RELATIVE_SERVER_DIR=$1
|
||||
MAIL_PROPERTIES=mail.properties
|
||||
ROOT_MAIL_PROPERTIES=/root/${MAIL_PROPERTIES}
|
||||
SAILING_USER=sailing
|
||||
SERVER_DIR=/home/${SAILING_USER}/servers/${RELATIVE_SERVER_DIR}
|
||||
CONFIGURATION_DIR=${SERVER_DIR}/configuration
|
||||
SAILING_MAIL_PROPERTIES=${CONFIGURATION_DIR}/${MAIL_PROPERTIES}
|
||||
if [ -f "${ROOT_MAIL_PROPERTIES}" ]; then
|
||||
echo "Found ${ROOT_MAIL_PROPERTIES}. Starting to copy to ${SAILING_MAIL_PROPERTIES}"
|
||||
mkdir -p "${SERVER_DIR}"
|
||||
chown ${SAILING_USER} ${SERVER_DIR}
|
||||
chgrp ${SAILING_USER} ${SERVER_DIR}
|
||||
mkdir -p "${CONFIGURATION_DIR}"
|
||||
chown ${SAILING_USER} ${CONFIGURATION_DIR}
|
||||
chgrp ${SAILING_USER} ${CONFIGURATION_DIR}
|
||||
cp ${ROOT_MAIL_PROPERTIES} ${SAILING_MAIL_PROPERTIES}
|
||||
chown ${SAILING_USER} ${SAILING_MAIL_PROPERTIES}
|
||||
chgrp ${SAILING_USER} ${SAILING_MAIL_PROPERTIES}
|
||||
else
|
||||
echo "Did not find ${ROOT_MAIL_PROPERTIES}. Cannot copy."
|
||||
fi
|
||||
@@ -0,0 +1 @@
|
||||
ALL ALL=NOPASSWD: /usr/local/bin/cp_root_mail_properties
|
||||
@@ -41,6 +41,11 @@ start_tmux() {
|
||||
|
||||
start_servers() {
|
||||
/usr/local/bin/update_authorized_keys_for_landscape_managers $( cat ${SSH_KEY_READER_BEARER_TOKEN} ) 2>&1 >>/var/log/sailing.err
|
||||
cp /home/sailing/code/configuration/cp_root_mail_properties /usr/local/bin
|
||||
chown root /usr/local/bin/cp_root_mail_properties
|
||||
chgrp root /usr/local/bin/cp_root_mail_properties
|
||||
chmod 755 /usr/local/bin/cp_root_mail_properties
|
||||
cp /home/sailing/code/configuration/cp_root_mail_properties_sudoers /etc/sudoers.d
|
||||
if which $EC2_METADATA_CMD && $EC2_METADATA_CMD -d | sed "s/user-data\: //g" | grep "^image-upgrade$"; then
|
||||
echo "Found image-upgrade in EC2 user data; upgrading image, then probably shutting down for AMI creation depending on the no-shutdown user data string..." >>/var/log/sailing.err
|
||||
$GIT_REPOSITORY/configuration/imageupgrade.sh
|
||||
|
||||
Reference in New Issue
Block a user