make janitor a systemd timer

one process lesser
This commit is contained in:
Girish Ramakrishnan
2015-09-11 17:41:31 -07:00
parent a1ddad7b7a
commit 2ec6c4ec77
4 changed files with 17 additions and 10 deletions
+1 -3
View File
@@ -11,8 +11,6 @@ var assert = require('assert'),
authcodedb = require('./src/authcodedb.js'),
database = require('./src/database.js');
var TOKEN_CLEANUP_INTERVAL = 30000;
function initialize(callback) {
assert.strictEqual(typeof callback, 'function');
@@ -52,7 +50,7 @@ function run() {
cleanupExpiredAuthCodes(function (error) {
if (error) console.error(error);
setTimeout(run, TOKEN_CLEANUP_INTERVAL);
process.exit(0);
});
});
}
+2 -2
View File
@@ -2,8 +2,8 @@
Description=Cloudron Smart Cloud
Documentation=https://cloudron.io/documentation.html
StopWhenUnneeded=true
Requires=apphealthtask.service box.service janitor.service oauthproxy.service
After=apphealthtask.service box.service janitor.service oauthproxy.service
Requires=apphealthtask.service box.service janitor.timer oauthproxy.service
After=apphealthtask.service box.service janitor.timer oauthproxy.service
# AllowIsolate=yes
[Install]
+4 -5
View File
@@ -1,16 +1,15 @@
[Unit]
Description=Cloudron Janitor
OnFailure=crashnotifier@%n.service
StopWhenUnneeded=true
[Service]
Type=idle
Type=simple
WorkingDirectory=/home/yellowtent/box
Restart=always
ExecStart=/usr/bin/node --optimize_for_size --max_semi_space_size=5 --max_old_space_size=30 /home/yellowtent/box/janitor.js
Restart=no
ExecStart=/usr/bin/node /home/yellowtent/box/janitor.js
Environment="HOME=/home/yellowtent" "USER=yellowtent" "DEBUG=box*,connect-lastmile" "BOX_ENV=cloudron" "NODE_ENV=production"
KillMode=process
User=yellowtent
Group=yellowtent
MemoryLimit=50M
WatchdogSec=30
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Cloudron Janitor
StopWhenUnneeded=true
[Timer]
# this activates it immediately
OnBootSec=0
OnUnitActiveSec=30min
Unit=janitor.service