1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
| # status abfragen
nmcli dev status
# liste W-lan
nmcli dev wifi list
sudo nmcli dev wifi connect network-ssid password "network-password"
# auto start service
nano /etc/systemd/system/mann.service
# ------------------------------ #
[Unit]
Description=mann
[Service]
Type=simple
ExecStart=/usr/bin/python3 /root/mann.py
[Install]
WantedBy=multi-user.target
#
systemctl enable mann.service
systemctl is-enabled mann.service
# ------------------------------ #
# ------- disney aktion -------- #
# --- grub Startbild entfernen --#
# nano /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
# GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || >
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
GRUB_BACKGROUND="/boot/grub/images/green.jpg"
GRUB_DISABLE_OS_PROBER=true
# ------------------------------ #
update-grub2
# switch.py
import sys, os
import gpiod
import time
LED_PIN = 18
BUTTON_PIN = 24
chip = gpiod.Chip('gpiochip4')
led_line = chip.get_line(LED_PIN)
button_line = chip.get_line(BUTTON_PIN)
led_line.request(consumer="LED", type=gpiod.LINE_REQ_DIR_OUT)
button_line.request(consumer="Button", type=gpiod.LINE_REQ_DIR_IN)
try:
while True:
button_state = button_line.get_value()
if button_state == 1:
led_line.set_value(1)
os.system('echo "done"')
# os.system('export DISPLAY=:0 && /usr/bin/mpv -fs /home/ranko/Videos/Disney01.mp4')
os.system('/bin/bash /home/ranko/disny/video.sh')
time.sleep(1)
else:
led_line.set_value(0)
# os.system('echo "up"')
time.sleep(0.2)
finally:
led_line.release()
button_line.release()
# -----------the end ------------ #
# video.sh
#/bin/bash
# suche nach laufende video pid
pid2=`pgrep -lf '02.mp4' | awk '{print $1}'`
sleep
# pid2=`pgrep -lf '02.mp4' | awk '{print $1}'`
# export DISPLAY=:0 && /usr/bin/mpv -fs /home/ranko/Videos/Disney01.mp4
echo $pid2
kill $pid2
export DISPLAY=:0 && /usr/bin/mpv -fs /home/ranko/Videos/Disney01.mp4
sleep 1
export DISPLAY=:0 && /usr/bin/mpv -fs --loop /home/ranko/Videos/Disney02.mp4 &
# ------------ ende -------------- #
# openvpn -
apt-get install openvpn
cp example.ovpn /etc/openvpn/client.conf
systemctl enable openvpn@client.service
service openvpn@client start
service openvpn@client status |
# status abfragen
nmcli dev status
# liste W-lan
nmcli dev wifi list
sudo nmcli dev wifi connect network-ssid password "network-password"
# auto start service
nano /etc/systemd/system/mann.service
# ------------------------------ #
[Unit]
Description=mann
[Service]
Type=simple
ExecStart=/usr/bin/python3 /root/mann.py
[Install]
WantedBy=multi-user.target
#
systemctl enable mann.service
systemctl is-enabled mann.service
# ------------------------------ #
# ------- disney aktion -------- #
# --- grub Startbild entfernen --#
# nano /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
# GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || >
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
GRUB_BACKGROUND="/boot/grub/images/green.jpg"
GRUB_DISABLE_OS_PROBER=true
# ------------------------------ #
update-grub2
# switch.py
import sys, os
import gpiod
import time
LED_PIN = 18
BUTTON_PIN = 24
chip = gpiod.Chip('gpiochip4')
led_line = chip.get_line(LED_PIN)
button_line = chip.get_line(BUTTON_PIN)
led_line.request(consumer="LED", type=gpiod.LINE_REQ_DIR_OUT)
button_line.request(consumer="Button", type=gpiod.LINE_REQ_DIR_IN)
try:
while True:
button_state = button_line.get_value()
if button_state == 1:
led_line.set_value(1)
os.system('echo "done"')
# os.system('export DISPLAY=:0 && /usr/bin/mpv -fs /home/ranko/Videos/Disney01.mp4')
os.system('/bin/bash /home/ranko/disny/video.sh')
time.sleep(1)
else:
led_line.set_value(0)
# os.system('echo "up"')
time.sleep(0.2)
finally:
led_line.release()
button_line.release()
# -----------the end ------------ #
# video.sh
#/bin/bash
# suche nach laufende video pid
pid2=`pgrep -lf '02.mp4' | awk '{print $1}'`
sleep
# pid2=`pgrep -lf '02.mp4' | awk '{print $1}'`
# export DISPLAY=:0 && /usr/bin/mpv -fs /home/ranko/Videos/Disney01.mp4
echo $pid2
kill $pid2
export DISPLAY=:0 && /usr/bin/mpv -fs /home/ranko/Videos/Disney01.mp4
sleep 1
export DISPLAY=:0 && /usr/bin/mpv -fs --loop /home/ranko/Videos/Disney02.mp4 &
# ------------ ende -------------- #
# openvpn -
apt-get install openvpn
cp example.ovpn /etc/openvpn/client.conf
systemctl enable openvpn@client.service
service openvpn@client start
service openvpn@client status