compose-website/unit-files/mysql-importer@.service
2014-11-11 17:16:22 +00:00

28 lines
656 B
Desktop File

[Unit]
Description=MySQL importer
# Dependency ordering
Before=mysql@%i.service
# Dependency binding
BindsTo=mysql@%i.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -euxc ' \
mysql_folder=/data/domains/%i/mysql; \
if [ ! -d /data/runtime/domains/%i/mysql ]; then \
if [ -d $mysql_folder ]; then \
echo develop import mysql feature; \
exit 1; \
else \
mkdir -p $mysql_folder; \
pass=`echo $RANDOM ${date} | md5sum | base64 | cut -c-10`; \
echo MYSQL_PASS=$pass > $mysql_folder/.env; \
mkdir -p /data/runtime/domains/%i/mysql; \
fi; \
fi'
[Install]
WantedBy=mysql@%i.service