Skip to content
Snippets Groups Projects
wordpress-importer@.service 776 B
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
[Unit]
Description=WordPress importer
Pierre Ozoux's avatar
Pierre Ozoux committed

# Dependency ordering
After=mysql-importer@%i.service
Before=wordpress@%i.service

# Dependency binding
BindsTo=wordpress@%i.service

[Service]
Type=oneshot
RemainAfterExit=yes
Pierre Ozoux's avatar
Pierre Ozoux committed
Environment=DOMAIN=%i
Pierre Ozoux's avatar
Pierre Ozoux committed
ExecStartPre=/data/indiehosters/scripts/backup-init.sh
ExecStart=/bin/bash -euxc ' \
  domain_folder=/data/domains/%i; \
  cp $domain_folder/TLS/%i.pem /data/runtime/haproxy/approved-certs/%i.pem; \
  if [ ! -d $domain_folder/wordpress/wp-content ]; then \
    mkdir -p $domain_folder/wordpress/; \
    cd $domain_folder/wordpress/; \
    tar xvzf /data/indiehosters/blueprints/wordpress.tgz; \
  fi; \
  cat $domain_folder/mysql/.env | sed s/MYSQL_PASS/DB_PASS/ > $domain_folder/wordpress/.env'


[Install]
WantedBy=wordpress@%i.service