-
Notifications
You must be signed in to change notification settings - Fork 8
/
app.js
70 lines (56 loc) · 1.76 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const express = require('express');
const { exec } = require('child_process');
const app = express();
const PORT = 8000;
app.use(express.static('public'));
app.get('/stop_a1111', (req, res) => {
exec('fuser -k 3001/tcp', (error, stdout, stderr) => {
if (error) {
console.error(`Error stopping A1111: ${error}`);
}
});
res.send('Stopped A1111 successfully!');
});
app.get('/start_a1111', (req, res) => {
exec('scripts/start_a1111.sh &', (error, stdout, stderr) => {
if (error) {
console.error(`Error starting A1111: ${error}`);
}
});
res.send('Started A1111 successfully!');
});
app.get('/stop_kohya', (req, res) => {
exec('fuser -k 3011/tcp', (error, stdout, stderr) => {
if (error) {
console.error(`Error stopping Kohya_ss: ${error}`);
}
});
res.send('Stopped Kohya_ss successfully!');
});
app.get('/start_kohya', (req, res) => {
exec('scripts/start_kohya.sh &', (error, stdout, stderr) => {
if (error) {
console.error(`Error starting Kohya_ss: ${error}`);
}
});
res.send('Started Kohya_ss successfully!');
});
app.get('/stop_comfyui', (req, res) => {
exec('fuser -k 3021/tcp', (error, stdout, stderr) => {
if (error) {
console.error(`Error stopping ComfyUI: ${error}`);
}
});
res.send('Stopped ComfyUI successfully!');
});
app.get('/start_comfyui', (req, res) => {
exec('scripts/start_comfyui.sh &', (error, stdout, stderr) => {
if (error) {
console.error(`Error starting ComfyUI: ${error}`);
}
});
res.send('Started ComfyUI successfully!');
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server is running on http://0.0.0.0:${PORT}`);
});