Advertisement
slabua

rc.local

Mar 16th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.77 KB | None | 0 0
  1. #!/bin/bash -e
  2. #
  3. # rc.local
  4. #
  5. # This script is executed at the end of each multiuser runlevel.
  6. # Make sure that the script will "exit 0" on success or any other
  7. # value on error.
  8. #
  9. # In order to enable or disable this script just change the execution
  10. # bits.
  11. #
  12. # By default this script does nothing.
  13.  
  14. # Print the IP address
  15. _IP=$(hostname -I) || true
  16. if [ "$_IP" ]; then
  17.   printf "My IP address is %s\n" "$_IP"
  18. fi
  19.  
  20. # SLB
  21. exec >/tmp/rc.local-output 2>&1; set -x
  22. nodejs /var/www/nstats/cpuinfo.js &
  23. #znc
  24. #route add default gw 192.168.1.1 wlan0
  25. ifdown eth0 && sleep 1 && ifup eth0 &
  26. # SLB
  27.  
  28. #RPiCameraBrowser
  29. echo "SLB 1"
  30. sleep 1
  31. shopt -s nullglob
  32.  
  33. video=-1
  34. for f in /var/www/media/video_*.mp4; do
  35.   video=`echo $f | cut -d '_' -f2 | cut -d '.' -f1`
  36. done
  37. video=`echo $video | sed 's/^0*//'`
  38. video=`expr $video + 1`
  39.  
  40. image=-1
  41. for f in /var/www/media/image_*.jpg; do
  42.   image=`echo $f | cut -d '_' -f2 | cut -d '.' -f1`
  43. done
  44. image=`echo $image | sed 's/^0*//'`
  45. image=`expr $image + 1`
  46.  
  47. shopt -u nullglob
  48.  
  49. echo "SLB 2"
  50. sleep 1
  51. mkdir -p /dev/shm/mjpeg
  52. /usr/bin/raspimjpeg -fp -w 512 -h 288 -wp 512 -hp 384 -d 1 -q 25 -of /dev/shm/mjpeg/cam.jpg -cf /var/www/FIFO -sf /var/www/status_mjpeg.txt -vf /var/www/media/video_%04d_%04d%02d%02d_%02d%02d%02d.mp4 -if /var/www/media/image_%04d_%04d%02d%02d_%02d%02d%02d.jpg -p -ic $image -vc $video > /dev/null &
  53.  
  54. #sleep 1
  55. #echo 'pm' > /var/www/FIFO
  56. #echo 'ro 90' > /var/www/FIFO
  57. #RPiCameraBrowser
  58.  
  59. echo "SLB 3"
  60. exit 0
  61.  
  62. --------------------------------------------
  63.  
  64. cat /tmp/rc.local-output
  65. + echo 'SLB 1'
  66. SLB 1
  67. + sleep 1
  68. + ifdown eth0
  69. + nodejs /var/www/nstats/cpuinfo.js
  70. + sleep 1
  71. + shopt -s nullglob
  72. + video=-1
  73. ++ echo -1
  74. ++ sed 's/^0*//'
  75. + video=-1
  76. ++ expr -1 + 1
  77. + video=0
  78. + ifup eth0
  79. cpuinfo @ 7010
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement