Skip to content

Auto start

Q-engineering edited this page Jun 23, 2022 · 5 revisions

Auto start

The autostart is defined in /etc/xdg/lxsession/LXDE-pi/autostart
Once opened you see:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@lxterminal -e /usr/local/bin/StartCam.sh

The last line starts the StartCam.sh script. You may remove this line.
Do not alter the others because the RPi desktop needs them to start properly.

StartCam.sh

#!/bin/sh
sleep 10
MotionEvent

The simple script waits for 10 seconds to give the RPi time to establish the internet and mail connection.
After this time, it starts MotionEvent, also located in /usr/local/bin.

Before you can use StartCam.sh make it executable with

sudo chmod 755 /usr/local/bin/StartCam.sh

Desktop icon

The desktop icon is defined in ~/Desktop/Camera.desktop

[Desktop Entry]
Version=1.1
Type=Application
Encoding=UTF-8
Name=Motion camera
Comment=Motion camera
Icon=/home/pi/software/Motion/CamIcon.png
Exec=lxterminal -e MotionEvent
Name[en_GB]=Motion

Before you can start the application by clicking the icon, you need to allow action in the File Manager.
Go to menu option Edit->Preferences, here check Don't ask options on launch executable file
output image

Menu icon

The menu entry is defined in /usr/share/applications/motion-cam.desktop

[Desktop Entry]
Name=Motion Camera
GenericName=Motion Camera
Comment=RPi motion camera
Exec=lxterminal -e /usr/local/bin/MotionEvent
Icon=/home/pi/software/Motion/CamIcon.png
Categories=AudioVideo;
Terminal=false
Type=Application
Clone this wiki locally