I'm trying to create a bash script
in order to daemonized celeryd task
. In my bash script, I need to create some files and add content. This content have a variable given by user named $app_name
with read method
and some others variables in the content.
Issue:
When I copy the content located in my bash script to the given path, it doesn't copy variables already present inside.
Example:
In my bash script I have :
########################
# Get application name #
########################
read -p "Define the application name (lowercase and without spaces): " app_name
echo "You defined the application name: $app_name"
############################################################
# Create service file /usr/local/etc/rc.d/celeryd_app_name #
############################################################
cat > /usr/local/etc/rc.d/celeryd_$app_name << EOF
#!/bin/sh
# =====================================================
# celeryd_$app_name - Starts the Celery worker daemon.
# =====================================================
#
# :Usage: /etc/init.d/celeryd_$app_name {start|stop|force-reload|restart|try-restart|status}
# :Configuration file: /etc/default/celeryd_$app_name
### BEGIN INIT INFO
# Provides: celeryd_$app_name
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
EOF
But if I open the created file I get:
### BEGIN INIT INFO
# Provides: celeryd_$app_name
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
It doesn't copy $network $local_fs $remote_fs
which are present in the content.
There is another way to do that ?
Thank you !