Feb 14 2017
RPI FAQ autostart
one of the frequent questions at forum is: autostart somethingnow there is first to make clear when to start something
summary:
-a- at system boot you need a "service" to start ( or run continuously )
-b- after a user login ( also for the putty logins )
-c- show something on desktop on start
-a- at system boot
about that i already write some things, also making some nice ZENITY tools around that,
but there is a change in the OS RASPBIAN
using systemd now the startfile syntax changed.
to learn about that i follow this blog.
as i changed in the progress i offer the files packed here:
cd
mkdir projects
cd projects
wget http://kll.engineering-news.org/kllfusion01/downloads/service_autostart.tar.xz
tar -xvf service_autostart.tar.xz
cd service_autostart
ls -la
cat disk-space-check.txt
sudo rm disk-space-check.txt
mkdir projects
cd projects
wget http://kll.engineering-news.org/kllfusion01/downloads/service_autostart.tar.xz
tar -xvf service_autostart.tar.xz
cd service_autostart
ls -la
cat disk-space-check.txt
sudo rm disk-space-check.txt
now lets see what i tested ( according above mentioned blog ) there:
this script i want to be executed after boot,
it creates a file disk-space-check.txt
what shows used disk space by /home/... means all users
and also how much space is still free on our system SD, looks like this:
Tue 14 Feb 13:20:50 ICT 2017
1.4G /home/
Avail
23G
1.4G /home/
Avail
23G
when we want to execute this at boot / system start we need a start / service file
this waits until network is up, execute the script from its home dir ( what itself stores the result in its home dir), but as its done by ROOT at boot, you will find that you need to delete it using sudo.
this service file needs to be copied and started with
./disk-space-check.service.install.sh
now check what happens after sudo reboot
check on service still run:
systemctl list-unit-files disk-space-check.service
check on result:
cat disk-space-check.txt
to remove this service pls use
./disk-space-check.service.remove.sh
-b- after a user login
one of the useful things when you work with terminal, ( from desktop or remote putty )
is to have some custom settings, done every time you open a terminal.
( means not use that to start an service as at second login , terminal.. you get the warnings that the service runs already)
if you need some thing executed or just remembered use
nano .bashrc
or in case of aliases better use
nano .bash_aliases what is called from .bashrc
so if you are a terminal user that's the thing for you.
and it looks like:
$ . .bash_aliases
use: work, workedit, di, dh, mc, mcedit, update, vnc, show_service, drop
DEBIAN jessie
Linux version 4.4.38-v7
CPU: armv7l
inet addr:192.168.1.203
cpu-temp=48.3'C
date: Tue 14 Feb 20:12:51 ICT 2017
use: work, workedit, di, dh, mc, mcedit, update, vnc, show_service, drop
DEBIAN jessie
Linux version 4.4.38-v7
CPU: armv7l
inet addr:192.168.1.203
cpu-temp=48.3'C
date: Tue 14 Feb 20:12:51 ICT 2017
-c- show something on desktop on start
there was a easy question at forum,
how to auto start a presentation
what showed me that there never anything is easy.
also because i wanted to show the OP how to do that completely from desktop / filemanager / leafpad editor...
assuming he is not the terminal type.
that is a job for a video and not for a tutorial text...
here short form:
-c.a- there is a
/home/pi/Documents/mypresentation.odp
-c.b- edit
now that was the main problem i had there, that impress start must be delayed or it opens and locks the presentation, until you manually recover the file.
-c.c- make it executable
chmod +x /home/pi/Documents/mypresentation.sh
and test with
./mypresentation.sh
-c.d- make a desktop file to execute it from desktop ...
and test it via desktop filemanager go Documents double click on desktop icon.
-c.e- for autostart need to copy the desktop file
cp /home/pi/Documents/mypresentation.desktop /home/pi/.config/autostart/mypresentation.desktop
sudo reboot
example using /etc/xdg/autostart/
here again some short tests for autostart:
THE JOB:
cd
chmod +x myautostart.sh
test it and find in user ram disk that file
ls /run/shm/
THE AUTOSTART:
way 1:
way 2:
update 23.10.2017
from a post at 4um i learned using systemd userlevel...
other example of USER autostart :
makes file
auto started by add line to