From 5fcb0fc284f5aa4c59ce0bae3dcd7855524ab939 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 31 Dec 2020 21:18:26 +0100 Subject: [PATCH] scripts --- config/srvconfig.json | 2 +- installSvc.sh | 5 +++++ nas-webdav.service | 14 ++++++++++++++ package.json | 5 +++-- src/index.ts | 2 +- start.sh | 2 ++ 6 files changed, 26 insertions(+), 4 deletions(-) create mode 100755 installSvc.sh create mode 100644 nas-webdav.service create mode 100755 start.sh diff --git a/config/srvconfig.json b/config/srvconfig.json index 8089574..cb3c232 100644 --- a/config/srvconfig.json +++ b/config/srvconfig.json @@ -1,6 +1,6 @@ { "port": 8088, - "realm": "manas", + "realm": "WebDAV-manas", "mounts": { "Music": "/media/hd1/Music", "Movies": "/media/hd1/Movies", diff --git a/installSvc.sh b/installSvc.sh new file mode 100755 index 0000000..2c9945e --- /dev/null +++ b/installSvc.sh @@ -0,0 +1,5 @@ +#!/bin/bash +sudo cp ./nas-webdav.service /etc/systemd/system/ +sudo systemctl enable nas-webdav +sudo systemctl start nas-webdav +sudo systemctl status nas-webdav diff --git a/nas-webdav.service b/nas-webdav.service new file mode 100644 index 0000000..08cb08c --- /dev/null +++ b/nas-webdav.service @@ -0,0 +1,14 @@ +[Unit] +Description=NAS WebDav-Server + +[Service] +EnvironmentFile=-/etc/default/my-application +ExecStart=/home/michael/nas-webdav/start.sh +WorkingDirectory=/home/michael/nas-webdav +LimitNOFILE=4096 +IgnoreSIGPIPE=false +KillMode=process +User=michael + +[Install] +WantedBy=multi-user.target diff --git a/package.json b/package.json index 9a1218a..092de74 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "build": "tsc -p ./tsconfig.json", + "build": "npx tsc -p ./tsconfig.json", "start": "node dist/index.js", "start-debug": "nodemon --inspect dist/index.js", "test": "echo \"Error: no test specified\" && exit 1" @@ -20,6 +20,7 @@ "webdav-server": "^2.6.2" }, "devDependencies": { + "typescript": "^3.9.7", "@types/node": "^14.11.2", "@typescript-eslint/eslint-plugin": "^4.1.1", "@typescript-eslint/parser": "^4.1.1", @@ -27,4 +28,4 @@ "prettier": "^2.1.2", "rimraf": "^3.0.2" } -} +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6119b72..3aaac66 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ const users = getConfig('users'); if (typeof config.port === undefined) config.port = 8080; if (typeof config.realm === undefined) - config.realm = "realm"; + config.realm = "WebDAV"; let mountNames : string[] = []; for (let mount in config['mounts']) { diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..f8d8c79 --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +#!/bin/bash +npm start \ No newline at end of file