Skip to content

Instantly share code, notes, and snippets.

@seanmavley
Created November 22, 2015 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save seanmavley/d09d7ef4bb1dd8aa873d to your computer and use it in GitHub Desktop.
Save seanmavley/d09d7ef4bb1dd8aa873d to your computer and use it in GitHub Desktop.
#!/bin/bash
clear
cd /path/to your/virtual environment #path to your virtual environment
. bin/activate #Activate your virtual environment
cd /path/to your/project directory #After that go to your project directory
python manage.py runserver #run django server
After that save this file with .sh extension. I have saved this file as script.sh in the following example.
Run following command in terminal for giving execution permission to your script
$ chmod u+x script.sh
4. To test your script works perfectly, add following command in terminal
$ ./ script.sh
5. After that, you have to create cron job on your machine for run script automatically on reboot give following command in terminal
$ crontab -e
Above command will open crontab window, then add the following line in it:
@reboot path/to/script.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment