3

I put the script "myscript.sh" with the following content into init.d:

#!/bin/bash
while :
do
    raspistill -v --width 1920 --height 1440 --quality 10 -t 1000 -o /home/pi/webcam/current.jpg
    sleep 3
    now=$(date +"%Y_%m_%d_-_%H_%M_%S")
    scp -i /home/pi/.ssh/id_rsa /home/pi/webcam/current.jpg user@1.2.3.4:/data/$now.jpg
    rm /home/pi/webcam/current.jpg
    sleep 10
done

I gave it execute permissions and also executed

sudo update-rc.d myscript defaults

and restarted the pi via sudo shutdown -r now.

Judging from the fact that I cannot ssh into the pi anymore (it's in a remote location), this was a mistake. How do I best fix it when I get there? Do I have to remove the memory card and manually change something, or is there a chance that the console is still reachable, just not via ssh? Depending on the answer, I would bring or not bring a monitor.

Will
  • 371
  • 4
  • 17
helm
  • 133
  • 3

1 Answers1

4

If I remember correctly, the operating system will not move beyond an init.d script until it has finished running. Essentially, your system is trying to launch its init.d script, but since this script never exists, your system never moves past it.

At this point you won't be able to log in via SSH or through the desktop. If you don't want to do a clean install on the SD card, your best bet would be to pull the card and edit the file system directly from another unix box.

Edit:

I just remembered that the Pi can be run under single user mode. If you edit cmdline.txt to include init=/bin/sh the Pi will boot up to a terminal prompt (with sudo privileges) and you will be able to edit the stuff locally.

Note: this skips all init processes so you won't have the ability to SSH in, and a monitor/keyboard will be required. This may or may not be more desirable than editing the whole thing from another computer, depending on your comfort level.

Source

Jacobm001
  • 11,904
  • 7
  • 47
  • 58