31 lines
1.4 KiB
Plaintext
31 lines
1.4 KiB
Plaintext
[Unit]
|
|
Description=Trove Guest
|
|
After=syslog.target
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=GUEST_USERNAME
|
|
Group=GUEST_USERNAME
|
|
|
|
ExecStartPre=mkdir -p GUEST_LOGDIR ; chown GUEST_USERNAME:root GUEST_LOGDIR
|
|
|
|
# If ~/trove-installed does not exist, copy the trove source from
|
|
# the user's development environment, then touch the sentinel file
|
|
ExecStartPre=/bin/bash "test -f /home/GUEST_USERNAME/trove-installed || sudo -u GUEST_USERNAME rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -avz --exclude='.*' HOST_SCP_USERNAME@NETWORK_GATEWAY:PATH_TROVE/ /home/GUEST_USERNAME/trove && touch /home/GUEST_USERNAME/trove-installed"
|
|
|
|
# If /etc/trove does not exist, create it and then copy the trove-guestagent.conf
|
|
# from /etc/trove on the user's development environment,
|
|
ExecStartPre=/bin/bash "test -d /etc/trove || sudo mkdir -p /etc/trove && sudo -u GUEST_USERNAME rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -avz --exclude='.*' HOST_SCP_USERNAME@NETWORK_GATEWAY:/etc/trove/trove-guestagent.conf ~GUEST_USERNAME/ && mv ~GUEST_USERNAME/trove-guestagent.conf /etc/trove/trove-guestagent.conf"
|
|
|
|
ExecStart=/home/GUEST_USERNAME/trove/bin/trove-guestagent --config-file=/etc/guest_info --config-file=/etc/trove/trove-guestagent.conf
|
|
|
|
# Give a reasonable amount of time for the server to start up/shut down
|
|
TimeoutSec=300
|
|
|
|
# Place temp files in a secure directory, not /tmp
|
|
PrivateTmp=true
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|