Add proftpd as service

This commit is contained in:
Johannes Zellner
2019-03-18 19:02:32 -07:00
parent a435e88b25
commit cde852f0f9
5 changed files with 172 additions and 0 deletions
+21
View File
@@ -211,6 +211,11 @@ const KNOWN_SERVICES = {
status: statusUnbound,
restart: restartUnbound,
defaultMemoryLimit: 0
},
proftpd: {
status: statusProftpd,
restart: restartProftpd,
defaultMemoryLimit: 0
}
};
@@ -1715,3 +1720,19 @@ function restartUnbound(callback) {
callback(null);
}
function statusProftpd(callback) {
assert.strictEqual(typeof callback, 'function');
shell.exec('statusProftpd', 'systemctl is-active proftpd', function (error) {
callback(null, { status: error ? exports.SERVICE_STATUS_STOPPED : exports.SERVICE_STATUS_ACTIVE });
});
}
function restartProftpd(callback) {
assert.strictEqual(typeof callback, 'function');
shell.sudo('restartProftpd', [ path.join(__dirname, 'scripts/restartproftpd.sh') ], {}, NOOP_CALLBACK);
callback(null);
}
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
set -eu -o pipefail
if [[ ${EUID} -ne 0 ]]; then
echo "This script should be run as root." > /dev/stderr
exit 1
fi
if [[ $# == 1 && "$1" == "--check" ]]; then
echo "OK"
exit 0
fi
if [[ "${BOX_ENV}" == "cloudron" ]]; then
systemctl restart proftpd
fi
+1
View File
@@ -18,6 +18,7 @@ scripts=("${SOURCE_DIR}/src/scripts/clearvolume.sh" \
"${SOURCE_DIR}/src/scripts/restart.sh" \
"${SOURCE_DIR}/src/scripts/restartdocker.sh" \
"${SOURCE_DIR}/src/scripts/restartunbound.sh" \
"${SOURCE_DIR}/src/scripts/restartproftpd.sh" \
"${SOURCE_DIR}/src/scripts/update.sh" \
"${SOURCE_DIR}/src/scripts/collectlogs.sh" \
"${SOURCE_DIR}/src/scripts/configurecollectd.sh" \