diff --git a/src/bin/gua.ts b/src/bin/gua.ts new file mode 100644 index 0000000..6184308 --- /dev/null +++ b/src/bin/gua.ts @@ -0,0 +1,23 @@ +import { spawn } from "child_process"; +import { systemdRunOptions } from "../commands/systemd.js"; +import path from "path"; +import { randomUUID } from "crypto"; +import chalk from "chalk"; + +const uuid = randomUUID() + + +spawn("systemd-run", + [ + `--working-directory=${path.resolve(process.cwd())}`, + ...systemdRunOptions({ + user: true, + unit: uuid, + }), + ...process.argv.slice(2), + ] +) + +console.log(`Service started as ID: ${uuid}, command suggest:`) +console.log(chalk.red(` systemctl --user status ${uuid}`)) +console.log(chalk.red(` journalctl --user -xeu ${uuid}`)) \ No newline at end of file