12,285
edits
mNo edit summary |
|||
Line 22: | Line 22: | ||
make a file startup_script.sh (shell script) with the following content: | make a file startup_script.sh (shell script) with the following content: | ||
<syntaxhighlight lang="bash"> | |||
clear | |||
echo "Automatic start up script running" | |||
date '+Date %Y-%m-%d Time %H:%m' | |||
echo -e "This is \c" && hostname | |||
ifconfig | grep "inet addr" | |||
sleep 2 | |||
clear | |||
sudo shutdown -h +540 & omxplayer -r movie.mp4 --loop | |||
</syntaxhighlight> | |||
sudo shutdown -h +540 will shut the Raspberry down in 9 hours. You will have to make the file executable with | sudo shutdown -h +540 will shut the Raspberry down in 9 hours. You will have to make the file executable with | ||
Line 47: | Line 49: | ||
Disable the getty program. | Disable the getty program. | ||
Find this line and comment it our by adding a # at the beginning of the line | Find this line and comment it our by adding a # at the beginning of the line | ||
<syntaxhighlight lang="bash"> | |||
#1:2345:respawn:/sbin/getty 115200 tty1 | |||
</syntaxhighlight> | |||
Add login program to inittab. | Add login program to inittab. | ||
Add the following line just below the commented line | Add the following line just below the commented line | ||
<syntaxhighlight lang="bash"> | |||
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1 | |||
</syntaxhighlight> | |||
This will run the login program with pi user and without any authentication | This will run the login program with pi user and without any authentication | ||
Line 58: | Line 64: | ||
Make it start the script automatically: | Make it start the script automatically: | ||
sudo nano .bashrc | sudo nano .bashrc | ||
<syntaxhighlight lang="bash"> | |||
and right at the end put: | and right at the end put: | ||
if [ $(tty) == /dev/tty1 ]; then | if [ $(tty) == /dev/tty1 ]; then | ||
./startup_script.sh | ./startup_script.sh | ||
fi | fi | ||
</syntaxhighlight> | |||
(that last 'if' makes sure the script is not starting in an x session) | (that last 'if' makes sure the script is not starting in an x session) | ||
Line 69: | Line 77: | ||
If you always want HDMI output, you would like to uncomment the lines | If you always want HDMI output, you would like to uncomment the lines | ||
<syntaxhighlight lang="bash"> | |||
hdmi_force_hotplug=1 | hdmi_force_hotplug=1 | ||
hdmi_drive=2 | hdmi_drive=2 | ||
</syntaxhighlight> | |||
all of the switches are explaned on [http://elinux.org/RPiconfig elinux] | all of the switches are explaned on [http://elinux.org/RPiconfig elinux] | ||
Line 167: | Line 176: | ||
[[Category:Max Neupert]] | |||
[[Category:Automation]] | [[Category:Automation]] | ||
[[Category:RaspberryPi]] | [[Category:RaspberryPi]] |