Using absolute names for the symlink breaks in quite a few ways;
* when creating a tar file of the logs,
* when serving via NFS,
or any other case where the directory gets transferred to
a different machine.
So just create the symlink with relative names, then they'll work
in any location.
Change-Id: I432a69754985fc71feb0068b7adca01066d7bc1b
| ... | ... |
@@ -1309,10 +1309,11 @@ function _run_process {
|
| 1309 | 1309 |
exec 3>&- |
| 1310 | 1310 |
exec 6>&- |
| 1311 | 1311 |
|
| 1312 |
- local real_logfile="${LOGDIR}/${service}.log.${CURRENT_LOG_TIME}"
|
|
| 1312 |
+ local logfile="${service}.log.${CURRENT_LOG_TIME}"
|
|
| 1313 |
+ local real_logfile="${LOGDIR}/${logfile}"
|
|
| 1313 | 1314 |
if [[ -n ${LOGDIR} ]]; then
|
| 1314 | 1315 |
exec 1>&"$real_logfile" 2>&1 |
| 1315 |
- ln -sf "$real_logfile" ${LOGDIR}/${service}.log
|
|
| 1316 |
+ bash -c "cd '$LOGDIR' && ln -sf '$logfile' ${service}.log"
|
|
| 1316 | 1317 |
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
| 1317 | 1318 |
# Drop the backward-compat symlink |
| 1318 | 1319 |
ln -sf "$real_logfile" ${SCREEN_LOGDIR}/screen-${service}.log
|
| ... | ... |
@@ -1399,7 +1400,8 @@ function screen_process {
|
| 1399 | 1399 |
|
| 1400 | 1400 |
screen -S $SCREEN_NAME -X screen -t $name |
| 1401 | 1401 |
|
| 1402 |
- local real_logfile="${LOGDIR}/${name}.log.${CURRENT_LOG_TIME}"
|
|
| 1402 |
+ local logfile="${name}.log.${CURRENT_LOG_TIME}"
|
|
| 1403 |
+ local real_logfile="${LOGDIR}/${logfile}"
|
|
| 1403 | 1404 |
echo "LOGDIR: $LOGDIR" |
| 1404 | 1405 |
echo "SCREEN_LOGDIR: $SCREEN_LOGDIR" |
| 1405 | 1406 |
echo "log: $real_logfile" |
| ... | ... |
@@ -1410,7 +1412,7 @@ function screen_process {
|
| 1410 | 1410 |
fi |
| 1411 | 1411 |
# If logging isn't active then avoid a broken symlink |
| 1412 | 1412 |
touch "$real_logfile" |
| 1413 |
- ln -sf "$real_logfile" ${LOGDIR}/${name}.log
|
|
| 1413 |
+ bash -c "cd '$LOGDIR' && ln -sf '$logfile' ${name}.log"
|
|
| 1414 | 1414 |
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
| 1415 | 1415 |
# Drop the backward-compat symlink |
| 1416 | 1416 |
ln -sf "$real_logfile" ${SCREEN_LOGDIR}/screen-${1}.log
|