Thanks: 0
Ergebnis 1 bis 2 von 2
-
20.05.2020, 18:57 #1
- Registriert seit
- 30.04.2020
- Beiträge
- 12
- Thanks (gegeben)
- 2
- Thanks (bekommen)
- 0
- Total Downloaded
- 0
- Total Downloaded
- 0
What script does OpenATV use to start enigma2?
Hello,
I am using minisatip on a linux box running OpenATV 6.3.
On boot up I would like to prevent enigma2 from starting and just start minisatip instead... or else maybe stop engima2 if it is running and then start minisatip. I have looked atCode:/usr/bin/enigma2.sh
This script will stop enigma2 if it is running and start minisatip... but I'm not sure where I should put it.
Code:if [ -f /home/root/no_enigma ]; then if [ `ps ax|grep minisatip|grep -v grep|wc -l |awk '{print $1;}` -gt 0 ]; then exit fi killall minisatip;sleep 2 killall enigma2 cd /home/root ./minisatip -l -l --dmx-source 0:0 exit fi
Any help much appreciated!
Flex
-
Advertising
-
24.05.2020, 00:49 #2
- Registriert seit
- 30.04.2020
- Beiträge
- 12
- Thanks (gegeben)
- 2
- Thanks (bekommen)
- 0
- Total Downloaded
- 0
- Total Downloaded
- 0
ThemenstarterWell I spent a few days on this and briefly here are my findings...
Yes....... /usr/bin/enigma2.sh IS the script that controls how the /usr/bin/enigma2 program starts.
I got my Amiko Alien2 box to start minisatip on boot up by replacing the contents of /usr/bin/enigma2.sh with a script that checks for the existence of a file in another directory... /home/root/no_enigma
If this file was present then the new enigma2.sh script started minisatip else it started enigma2 as normal, like this:
Code:#!/bin/sh # Check if the no_enigma file exists if [ -f /home/root/no_enigma ]; then # If enigma2 is running then kill it ENIGMA_PID=$(ps ax|grep -w "/usr/bin/enigma2$"|grep -v grep|wc -l | awk '{print $1}') if [ "$ENIGMA_PID" -gt 0 ]; then echo "enigma2 is running, killing it now" current_time=$(date "+%Y.%m.%d-%H.%M.%S") touch /home/root/Killing-enigma2-enigma2.sh-$current_time init 4 else echo "enigma2 is not running" fi # Check if minisatip is running already, if not then start it MINI_PID=$(ps ax|grep minisatip|grep -v grep|wc -l | awk '{print $1}') if [ "$MINI_PID" -gt 0 ]; then echo "minisatip is already running" else echo "minisatip is not running" echo "starting minisatip" current_time=$(date "+%Y.%m.%d-%H.%M.%S") touch /home/root/Starting-minisatip-enigma2.sh-$current_time /usr/bin/minisatip --satip-xml http://127.0.0.1:8554 -R /usr/share/minisatip/html fi else # The no_enigma file does not exist or has been re-named # Check if minisatip is running, if yes then kill it MINI_PID=$(ps ax|grep minisatip|grep -v grep|wc -l | awk '{print $1}') if [ "$MINI_PID" -gt 0 ]; then echo "minisatip is running, killing it now" current_time=$(date "+%Y.%m.%d-%H.%M.%S") touch /home/root/Killing-minisatip-enigma2.sh-$current_time killall minisatip else echo "minisatip is not running" fi # Check if enigma2 is running already, if not then start it ENIGMA_PID=$(ps ax|grep -w "/usr/bin/enigma2$"|grep -v grep|wc -l | awk '{print $1}') if [ "$ENIGMA_PID" -gt 0 ]; then echo "enigma2 is already running" else echo "enigma2 is not running" echo "starting enigma2" # See explanation in below link for the.... > /dev/null 2>&1 & bit! # shell - What does "2>&1" do in command line? - Super User #/home/root/run_enigma.sh > /dev/null 2>&1 & current_time=$(date "+%Y.%m.%d-%H.%M.%S") touch /home/root/Starting-enigma2-enigma2.sh-$current_time #nohup /usr/local/bin/run_enigma.sh > /dev/null 2>&1 & /usr/local/bin/run_enigma.sh fi fi
But in fact I then ended up reverting those files to the way they were and creating another script than presents a menu to allow you to switch between running just enigma2 and just running minisatip, like this...
Code:#!/bin/bash #================================================================ # This script is intended to be executed when Alien2 is already # running and you want to switch between enigma2 and minisatip #================================================================ ## ---------------------------------- # Step #1: Define variables # ---------------------------------- EDITOR=vim PASSWD=/etc/passwd RED='\033[0;41;30m' STD='\033[0;0;39m' # ---------------------------------- # Step #2: User defined functions # ---------------------------------- status(){ enigma_pid=$(ps ax|grep -w "/usr/bin/enigma2$"|grep -v grep|wc -l | awk '{print $1}') if [ "$enigma_pid" -gt 0 ]; then echo "Enigma2: Running" else echo "Enigma2: Not Running" fi mini_pid=$(ps ax|grep minisatip|grep -v grep|wc -l | awk '{print $1}') if [ "$mini_pid" -gt 0 ]; then echo "Minisatip: Running" else echo "Minisatip: Not Running" fi } pause(){ read -p "Press [Enter] key to continue..." fackEnterKey } # do something in one() one(){ echo "Run minisatip only" # If enigma2 is running then kill it enigma_pid=$(ps ax|grep -w "/usr/bin/enigma2$"|grep -v grep|wc -l | awk '{print $1}') if [ "$enigma_pid" -gt 0 ]; then echo "enigma2 is running, killing it now" #current_time=$(date "+%Y.%m.%d-%H.%M.%S") #touch /home/root/Killing-enigma2-satip-$current_time init 4 #killall enigma2 <-- For some reason this stops enigma2 but then restarts it immediately? Something to do with bash? else echo "enigma2 is not running" fi # Check if minisatip is running already, if not then start it mini_pid=$(ps ax|grep minisatip|grep -v grep|wc -l | awk '{print $1}') if [ "$mini_pid" -gt 0 ]; then echo "minisatip is already running" else echo "minisatip is not running" echo "starting minisatip" #current_time=$(date "+%Y.%m.%d-%H.%M.%S") #touch /home/root/Starting-minisatip-satip-$current_time /usr/bin/minisatip --satip-xml http://127.0.0.1:8554 -R /usr/share/minisatip/html fi pause } # do something in two() two(){ echo "Run enigma2 only" # Check if minisatip is running, if yes then kill it mini_pid=$(ps ax|grep minisatip|grep -v grep|wc -l | awk '{print $1}') if [ "$mini_pid" -gt 0 ]; then echo "minisatip is running, killing it now" #current_time=$(date "+%Y.%m.%d-%H.%M.%S") #touch /home/root/Killing-minisatip-satip-$current_time killall minisatip #<-- Unlike with killall enigma2 this does NOT cause minisatip to stop and then start again! else echo "minisatip is not running" fi # Check if enigma2 is running already, if not then start it enigma_pid=$(ps ax|grep -w "/usr/bin/enigma2$"|grep -v grep|wc -l | awk '{print $1}') if [ "$enigma_pid" -gt 0 ]; then echo "enigma2 is already running" else echo "enigma2 is not running" echo "starting enigma2" #current_time=$(date "+%Y.%m.%d-%H.%M.%S") #touch /home/root/starting-enigma2-satip-$current_time # Previously [init 3] wasn't restarting enigma2 but now works again, not sure why? init 3 #nohup /usr/local/bin/run_enigma.sh > /dev/null 2>&1 & #nohup /usr/local/bin/run_enigma.sh & #reboot fi pause } # do something in three() three(){ echo "" echo "<< Help Section >>" echo "" echo "When you boot up Alien2 it starts enigma2" echo "Use this to switch between enigma2 and minisatip" echo "" pause } # function to display menus show_menus() { clear echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo " SWITCH ENIGMA <> MINISATIP " echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~" status echo "" echo "1. Run minisatip only" echo "2. Run enigma2 only" echo "3. Help" echo "4. Exit" } # read input from the keyboard and take a action # invoke the methods: one(), two() or three() # when the user selects 1, 2 or 3 from the menu option. # Exit when user the user select 3 form the menu option. read_options(){ local choice read -p "Enter choice [ 1 - 4] " choice case $choice in 1) one ;; 2) two ;; 3) three ;; 4) exit 0;; *) echo -e "${RED}Error...${STD}" && sleep 2 esac } # ---------------------------------------------- # Step #3: Trap CTRL+C, CTRL+Z and quit singles # ---------------------------------------------- trap '' SIGINT SIGQUIT SIGTSTP # ----------------------------------- # Step #4: Main logic - infinite loop # ------------------------------------ while true do show_menus read_options done
Flex
Lesezeichen