43 lines
1012 B
Bash
Executable File
43 lines
1012 B
Bash
Executable File
#!/bin/bash
|
|
#Absolute path to this script
|
|
SCRIPT=$(readlink -f $0)
|
|
#Absolute path this script is in
|
|
SCRIPTPATH=$(dirname $SCRIPT)
|
|
STACK=$(basename "$SCRIPTPATH")
|
|
|
|
for VOLUME in onlyoffice_data onlyoffice_log
|
|
do
|
|
systemctl enable mnt-cinder-volume@${VOLUME}.service
|
|
done
|
|
|
|
cat << EOF > /etc/systemd/system/${STACK}.service
|
|
[Unit]
|
|
Description=Starting ${STACK}
|
|
After=network-online.target firewalld.service docker.service docker.socket
|
|
Wants=network-online.target docker.service
|
|
Requires=docker.socket
|
|
EOF
|
|
|
|
for VOLUME in onlyoffice_data onlyoffice_log
|
|
do
|
|
cat << EOF >> /etc/systemd/system/${STACK}.service
|
|
After=mnt-cinder-volume@${VOLUME}.service
|
|
After=mnt-volumes-${VOLUME}.mount
|
|
Wants=mnt-cinder-volume@${VOLUME}.service
|
|
Requires=mnt-volumes-${VOLUME}.mount
|
|
|
|
EOF
|
|
done
|
|
|
|
cat << EOF >> /etc/systemd/system/${STACK}.service
|
|
[Service]
|
|
Type=oneshot
|
|
User=$SUDO_USER
|
|
ExecStart=$SCRIPTPATH/start.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl daemon-reload
|
|
systemctl enable docker-onlyoffice-stack.service
|