0
$ cat appleclue.sh 
#!/usr/local/bin/bash

source ~/.venv/appleclue/bin/activate
cd ~/applications/appleclue/appleclue-web/ 
git pull 
pip install -r requirements.txt 
python3.9 manage.py migrate --noinput 
python3.9 manage.py collectstatic --noinput
sudo service gunicorn_appleclue restart

So the last line spawns a daemon (/usr/sbin/daemon), which will keeps running. But it won't return to the shell unless I press enter another time.

Is it possible to tell my script to return to the prompt, without needing to press enter?

2

1 Answer 1

0

Several ways to do this. One is to add an exit code at the end of the script.

#!/usr/local/bin/bash

source ~/.venv/appleclue/bin/activate
cd ~/applications/appleclue/appleclue-web/ 
git pull 
pip install -r requirements.txt 
python3.9 manage.py migrate --noinput 
python3.9 manage.py collectstatic --noinput
sudo service gunicorn_appleclue restart
exit 0

If that is not possible, you can add an exit at the end of the command as so:

<path_to_script> && exit

Or if executing this way:

./<script> && exit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.