I'm testing ETCD but I'm having some hard time trying to store the ETCD logs in a file.
The problem happens when I try to execute ETCD in the background inside of a shell script.
Here is my etcd startup script:
#!/bin/bash
IP_ADDRESS=`/usr/bin/hostname -I | sed "s/ //g"`: "${HOST_NAME:=${IP_ADDRESS}}"ETCD_LOG_FILE=/var/log/etcd.log
export ETCD_LISTEN_CLIENT_URLS=http://${IP_ADDRESS}:2379,http://127.0.0.1:2379export ETCD_LISTEN_PEER_URLS=http://${IP_ADDRESS}:2380export ETCD_INITIAL_ADVERTISE_PEER_URLS=http://${IP_ADDRESS}:2380export ETCD_ADVERTISE_CLIENT_URLS=http://${IP_ADDRESS}:2379export ETCD_INITIAL_CLUSTER_TOKEN=testexport ETCD_INITIAL_CLUSTER_STATE=newexport ETCD_AUTO_COMPACTION_RETENTION=1export ETCD_INITIAL_CLUSTER=${HOST_NAME}=http://${IP_ADDRESS}:2380
cd /opt/etcd# TO DO: add logging/usr/bin/nohup echo "Starting ETCD" >> $ETCD_LOG_FILE 2>&1 &/usr/bin/nohup /opt/etcd/bin/etcd --name $HOST_NAME --data-dir /opt/etcd/data >> $ETCD_LOG_FILE 2>&1 &
ETCD starts as it should but I can't see any etcd log message on the $ETCD_LOG_FILE.
I can see only "Starting ETCD" but not the etcd log lines.
When I run the last line manually from outside the script (after setting the vars) everything works fine. I can see all the logs on the file.
Here is the command:
/usr/bin/nohup /opt/etcd/bin/etcd --name $HOST_NAME --data-dir /opt/etcd/data >> $ETCD_LOG_FILE 2>&1 &
Can someone give me a hint of what is the problem, please?
Thanks,
Francisco Andrade