servicer-labs / servicer

A CLI to simplify service management on systemd
https://servicer.dev
MIT License
427 stars 9 forks source link

NodeJS service not running? #11

Closed Vap0r1ze closed 1 year ago

Vap0r1ze commented 1 year ago

I'm unable to get a nodejs service to actually run, it just goes inactive immediately. I'm running Ubuntu 22.04.03 on arm64, and I have node installed via fnm.

Here's me trying to start it and it immediately going inactive, along with the logs:

root@ubuntu-8gb-fsn1-2:~/swamp/counting# servicer create --name "count" index.js --start --enable
got path /root/.local/state/fnm_multishells/8861_1698007633190/bin/node

Service count created at /etc/systemd/system/count.ser.service. To start run `ser start count`
service started: /org/freedesktop/systemd1/job/1198
Enabled count
+-----+-------+----------+----------------+-------+--------+
| pid | name  | active   | enable on boot | cpu % | memory |
+-----+-------+----------+----------------+-------+--------+
| 0   | count | inactive | true           | 0     | 0      |
+-----+-------+----------+----------------+-------+--------+
root@ubuntu-8gb-fsn1-2:~/swamp/counting# servicer start count
service started: /org/freedesktop/systemd1/job/1281
+------+-------+--------+----------------+-------+--------+
| pid  | name  | active | enable on boot | cpu % | memory |
+------+-------+--------+----------------+-------+--------+
| 8911 | count | active | true           | 0     | 3.6 KB |
+------+-------+--------+----------------+-------+--------+
root@ubuntu-8gb-fsn1-2:~/swamp/counting# servicer status
+-----+-------+----------+----------------+-------+--------+
| pid | name  | active   | enable on boot | cpu % | memory |
+-----+-------+----------+----------------+-------+--------+
| 0   | count | inactive | true           | 0     | 0      |
+-----+-------+----------+----------------+-------+--------+
root@ubuntu-8gb-fsn1-2:~/swamp/counting# servicer logs count
Oct 22 20:41:28 ubuntu-8gb-fsn1-2 systemd[1]: count.ser.service: Deactivated successfully.
Oct 22 20:44:40 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:45:13 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:45:13 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:45:13 ubuntu-8gb-fsn1-2 systemd[1]: Started Servicer:count.
Oct 22 20:45:14 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:45:14 ubuntu-8gb-fsn1-2 systemd[1]: count.ser.service: Deactivated successfully.
Oct 22 20:45:23 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:47:13 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:47:13 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:47:13 ubuntu-8gb-fsn1-2 systemd[1]: Started Servicer:count.
Oct 22 20:47:13 ubuntu-8gb-fsn1-2 systemd[1]: /etc/systemd/system/count.ser.service:12: Missing '=', ignoring line.
Oct 22 20:47:13 ubuntu-8gb-fsn1-2 systemd[1]: count.ser.service: Deactivated successfully.
Oct 22 20:47:20 ubuntu-8gb-fsn1-2 systemd[1]: Started Servicer:count.
Oct 22 20:47:20 ubuntu-8gb-fsn1-2 systemd[1]: count.ser.service: Deactivated successfully.
root@ubuntu-8gb-fsn1-2:~/swamp/counting#
secretshardul commented 1 year ago

Replicated this issue with Deno. Somehow index.js ended up on a separate line (line 12). Pushing a fix.

# Generated with Servicer
[Unit]
Description=Servicer:index.js
After=network.target

[Service]
Type=simple
User=hp

WorkingDirectory=/home/hp/Documents/servicer-labs/hello-world-node
ExecStart=/home/hp/.deno/bin/deno
 index.js

[Install]
WantedBy=multi-user.target
secretshardul commented 1 year ago

Fixed with v0.1.13. Had to remove the newline character /n from the binary path. Please confirm whether it works so I can close the issue.

Vap0r1ze commented 1 year ago

yes it works with node now thank you!