Skip to content

Commit

Permalink
Update import-email-to-piler.service to include environment file and …
Browse files Browse the repository at this point in the history
…set working directory
  • Loading branch information
stephdl committed Apr 26, 2024
1 parent 88c2ccb commit d94be09
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions imageroot/actions/configure-module/80start_services
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ for ((i = 0; i < 60; i++)); do
echo "Waiting for piler-app to be active..."
sleep 1
done

13 changes: 13 additions & 0 deletions imageroot/actions/configure-module/91import-email
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

# This script is used to start the import-email-to-piler.service
if [[ -f 'sync2pilerdone' ]]; then
echo "## sync2pilerdone file is found, mail already migrated, exiting"
exit 0
fi
systemctl --user start import-email-to-piler.service
13 changes: 1 addition & 12 deletions imageroot/systemd/user/import-email-to-piler.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@
#
[Unit]
Description= import emails to piler
BindsTo=piler.service
After=piler-app.service
ConditionPathExists=!%S/state/sync2pilerdone

[Service]
EnvironmentFile=%S/state/environment
WorkingDirectory=%S/state
Restart=always
TimeoutStopSec=70
ExecStartPre=/usr/bin/bash -c "while [ -z "$MAIL_SERVER" ]; do echo '## Waiting the MAIL_SERVER is set' && sleep 5 ; done"
ExecStart=/usr/local/bin/runagent import-emails
Type=forking

[Install]
WantedBy=default.target
Type=simple
1 change: 0 additions & 1 deletion imageroot/systemd/user/piler-app.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Description=Podman piler-app.service
BindsTo=piler.service
After=piler.service mariadb-app.service memcached-app.service
Before=import-email-to-piler.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Expand Down
5 changes: 2 additions & 3 deletions imageroot/systemd/user/piler.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

[Unit]
Description=Podman piler.service
Requires=mariadb-app.service piler-app.service memcached-app.service import-email-to-piler.service
Before=mariadb-app.service piler-app.service memcached-app.service import-email-to-piler.service

Requires=mariadb-app.service piler-app.service memcached-app.service
Before=mariadb-app.service piler-app.service memcached-app.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
EnvironmentFile=-%S/state/environment
Expand Down

0 comments on commit d94be09

Please sign in to comment.