Skip to content

use "pwd -P" instead of "pwd" in etc/init.d scripts #321

@craigmcchesney

Description

@craigmcchesney

It took me a long time to figure this out, but if I use a symbolic link pointing to the deployment directory (e.g., /opt/traveler/current) instead of the directory itself (/opt/traveler/traveler-APS-1.5.5), the scripts fail due to module resolution errors.

For example, if I run "./etc/init.d/traveler-webapp stop" from /opt//traveler/current it fails with the error "[PM2][ERROR] Process or Namespace /opt/traveler/current/app.js not found", but it works if I run it from /opt/traveler/traveler-APS-1.5.5.

I tested that changing:
MY_DIR=dirname $0
CUR_DIR=pwd
cd $MY_DIR
MY_DIR=pwd
cd $CUR_DIR

to:
MY_DIR=dirname $0
CUR_DIR=pwd -P
cd $MY_DIR
MY_DIR=pwd -P
cd $CUR_DIR

solves the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions