deploy icon indicating copy to clipboard operation
deploy copied to clipboard

SHARED env variable in post-deploy hook is blank

Open slaskis opened this issue 14 years ago • 2 comments

Hey, I'm trying to use a little hook magic for my node server, something like this:

post-deploy npm install && (cat $SHARED/pids/master.pid | xargs kill -s SIGUSR2) || PORT=8001 node server.js >> $SHARED/logs/node.log 2>&1

and well, it fails because $SHARED is blank, so I tried this to confirm:

post-deploy env

which listed SHARED=/home/deploy/app/shared as expected, but trying this:

post-deploy cat $SHARED/pids/master.pid

fails with cat: /pids/master.pid: No such file or directory, in other words SHARED is blank...

am I using it wrong?

It's on ubuntu 10.4 (installed using the node knockout linode stack script )

slaskis avatar Oct 12 '11 14:10 slaskis

hmmm not too sure off hand, i'll have to take a look

tj avatar Oct 12 '11 15:10 tj

Sounds like your command is being interpreted twice: the local shell sees the variable and replaces it with blank, hiding it from the remote shell where $SHARED is actually set.

Maybe try cat \$SHARED/pids/master.pid or cat '$SHARED/pids/master.pid' or various combinations of escaping to get the variable to arrive where it can be used.

bronson avatar Apr 26 '12 19:04 bronson