Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleaner startup script scratch_gpio2.sh #1

Open
jdchristensen opened this issue Jul 24, 2013 · 0 comments
Open

cleaner startup script scratch_gpio2.sh #1

jdchristensen opened this issue Jul 24, 2013 · 0 comments

Comments

@jdchristensen
Copy link

The following version of the startup script is cleaner in a few ways:

  • it uses /bin/sh (dash) instead of bash, which uses less memory and is faster to start
  • it uses pkill instead of a long pipeline to kill old copies of the python script
  • it uses trap to kill the current copy of the python script when the program exits
  • it doesn't put scratch into the background, so that when scratch ends the trap
    command will be executed.
#!/bin/sh

#Version 0.2 - add in & to allow simulatenous running of handler and Scratch
#Version 0.3 - change sp launches rsc.sb from "/home/pi/Documents/Scratch Projects"
#Version 0.4 - 20Mar13 meltwater - change to use provided name for home

sudo pkill -9 -f scratch_gpio_handler2.py

trap 'sudo pkill -9 -f scratch_gpio_handler2.py' 0 1 2 3 7 9 11 13 15

sudo python /home/pi/simplesi_scratch_handler/scratch_gpio_handler2.py &

scratch --document "/home/pi/Documents/Scratch Projects/rsc.sb" 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant