Automatically stop and start the service when deploying...w
[rup.git] / deploy.ps1
index 5edd2a4..219d4ee 100755 (executable)
@@ -1,3 +1,12 @@
+if ($args.Count -lt 1) {
+   $scriptName = [Environment]::GetCommandLineArgs()[1]
+   echo "Usage: $scriptName <destination>"
+   exit 1
+}
+
+
+systemctl --user stop www-rouleunpet.service
+
 git pull
 cargo build --release
 
@@ -9,6 +18,13 @@ if (!(Test-Path -Path $destination)) {
 
 Copy-Item target/release/rup -Destination $destination
 Copy-Item key.secret -Destination $destination
-Copy-Item conf.ron -Destination $destination
+
 Copy-Item static -Destination $destination -Recurse -Force
 
+# Do not overwrite the configuration.
+if (!(Test-Path -Path $destination/conf.ron)) {
+   Copy-Item conf.ron -Destination $destination
+}
+
+systemctl --user start www-rouleunpet.service
+