compose-website/unit-files/mysql-importer@.service
2014-11-07 15:58:15 +00:00

28 lines
639 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 $mysql_folder ]; then \
mkdir -p $mysql_folder; \
pass=`echo $RANDOM ${date} | md5sum | base64 | cut -c-10`; \
echo MYSQL_PASS=$pass > $mysql_folder/.env; \
fi; \
if [ -f $mysql_folder/dump.sql ]; then \
echo develop import mysql feature; \
exit 1; \
else \
mkdir -p /data/runtime/domains/%i/mysql/db_files; \
fi'
[Install]
WantedBy=mysql@%i.service