I have a Shellscript that starts a python command (taken from HERE)
#!/bin/sh
COMMAND='cd /sc2ai/agent && python3 myscript.py'
LOGFILE=restart.txt
writelog() {
now=`date`
echo "$now $*" >> $LOGFILE
}
writelog "Starting"
while true ; do
$COMMAND
writelog "Exited with status $?"
writelog "Restarting"
done
I would like this script to be executed immediately after the Container is loaded and I am doing it like this: (the very last lines of my Dockerfile
)
# Run Apache
CMD apachectl -D FOREGROUND
# Start the Agent
RUN chmod +x agent.sh
ENTRYPOINT ["/bin/bash", "./agent.sh"]
The builds, but upon starting (docker-compose up -d --build && winpty docker-compose run sc2 bash
) it creates this error:
./agent.sh: line 2: $'\r': command not found
./agent.sh: line 5: $'\r': command not found
./agent.sh: line 6: syntax error near unexpected token `$'{\r''
'/agent.sh: line 6: `writelog() {
What am I doing wrong?