create-entity-server 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-entity-server",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Create a new entity-server project in one command — like create-react-app or create-vite.",
5
5
  "keywords": [
6
6
  "entity-server",
@@ -29,6 +29,24 @@ has_command() {
29
29
  command -v "$1" >/dev/null 2>&1
30
30
  }
31
31
 
32
+ # 현재 프로젝트를 관리하는 systemd 서비스명을 반환합니다.
33
+ find_systemd_service() {
34
+ local unit=""
35
+ local exec_start=""
36
+
37
+ has_command systemctl || return 1
38
+
39
+ for unit in $(systemctl list-units --type=service --state=active,activating --no-legend 2>/dev/null | awk '{print $1}'); do
40
+ exec_start=$(systemctl show -p ExecStart --value "$unit" 2>/dev/null || true)
41
+ if [[ "$exec_start" == *"$PROJECT_ROOT/scripts/run.sh"* ]] || [[ "$exec_start" == *"$SERVER_BIN"* ]]; then
42
+ echo "$unit"
43
+ return 0
44
+ fi
45
+ done
46
+
47
+ return 1
48
+ }
49
+
32
50
  # PID 프로세스명을 읽습니다.
33
51
  get_pid_name() {
34
52
  local pid="$1"
@@ -441,6 +459,16 @@ stop_pid_with_confirm() {
441
459
  }
442
460
 
443
461
  stop_server() {
462
+ local svc=""
463
+ svc=$(find_systemd_service || true)
464
+ if [ -n "$svc" ]; then
465
+ echo "ℹ️ systemd 서비스 중지: $svc"
466
+ sudo systemctl stop "$svc"
467
+ rm -f "$PID_FILE"
468
+ echo "✅ ${SERVER_NAME} 종료 완료 (systemd)"
469
+ return 0
470
+ fi
471
+
444
472
  local pid=""
445
473
 
446
474
  pid=$(find_active_server_pid)
@@ -466,6 +494,14 @@ stop_server() {
466
494
  }
467
495
 
468
496
  show_status() {
497
+ local svc=""
498
+ svc=$(find_systemd_service || true)
499
+ if [ -n "$svc" ]; then
500
+ echo "ℹ️ systemd 서비스로 관리 중: $svc"
501
+ sudo systemctl status "$svc" --no-pager 2>/dev/null || true
502
+ return
503
+ fi
504
+
469
505
  local status_pid=""
470
506
 
471
507
  status_pid=$(find_active_server_pid || true)
@@ -605,6 +641,21 @@ case "$MODE" in
605
641
  ;;
606
642
 
607
643
  start)
644
+ # systemd 서비스가 등록되어 있으면 systemctl 로 관리한다.
645
+ svc=$(find_systemd_service || true)
646
+ if [ -n "$svc" ]; then
647
+ svc_state=$(systemctl is-active "$svc" 2>/dev/null || true)
648
+ if [ "$svc_state" = "active" ]; then
649
+ echo "ℹ️ ${SERVER_NAME}가 systemd 서비스로 이미 실행 중입니다: $svc"
650
+ echo " 재시작: sudo systemctl restart $svc"
651
+ exit 0
652
+ fi
653
+ echo "ℹ️ systemd 서비스 시작: $svc"
654
+ sudo systemctl start "$svc"
655
+ echo "✅ ${SERVER_NAME} 시작 완료 (systemd)"
656
+ exit 0
657
+ fi
658
+
608
659
  running_pid=$(find_active_server_pid || true)
609
660
  if [ -n "$running_pid" ]; then
610
661
  if [ "$LANGUAGE" = "en" ]; then