RASPBERRY PI 3 B - script de pornire oscam

Raspberry Pi
User avatar
allsattnt
Standard User
Posts: 237
Joined: 07 Dec 2014 19:15

RASPBERRY PI 3 B - script de pornire oscam

Unread postby allsattnt » 09 Jan 2017 14:16

Salut.
Am placa asta si vreau sa pun un script de pornire a oscam la fiecare restart al oscam sau raspberry.
Acum am unul de forma:

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides:          Oscam
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Oscam init script
# Description:       Launch oscam at startup
### END INIT INFO
 
DAEMON=/usr/local/bin/oscam
DEAMON_OPTS="-b -r 2"
PIDFILE=/var/run/oscam.pid
 
test -x ${DAEMON} || exit 0
 
. /lib/lsb/init-functions
 
case "$1" in
    start)
   log_daemon_msg "Starting OScam"
   start-stop-daemon --start --quiet --background --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} -- ${DAEMON_OPTS}
   log_end_msg $?
    ;;
    stop)
   log_daemon_msg "Stopping OScam"
   start-stop-daemon --stop --exec ${DAEMON}
   log_end_msg $?
    ;;
    force-reload|restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage: /etc/init.d/oscam {start|stop|restart|force-reload}"
    exit 1
    ;;
esac
 
exit 0


acesta fiind scriptul ,,oscam'' din init.d
Nu porneste oscam decat cu comanda din PuTTy.
Este luat de pe net.
Am vazut ca nu am ,,oscam.pid'' in fisierul var/run/
E prima data cand traiesc,asa ca e omeneste sa mai si gresesc!
danyconnect
New member
Posts: 2
Joined: 22 Jul 2014 02:00

Re: RASPBERRY PI 3 B

Unread postby danyconnect » 09 Jan 2017 18:42

Code: Select all

#!/bin/bash
### BEGIN INIT INFO
# Provides:          oscam
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Init script for oscam
### END INIT INFO

. /lib/lsb/init-functions

NAME=oscam
DAEMON=/usr/bin/oscam
DAEMON_OPTS='-S -r 2'
PIDFILE=/var/run/oscam.pid


start() {
           log_daemon_msg "Starting daemon: $NAME "
      start-stop-daemon --start --quiet --background --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
}

stop() {
      log_daemon_msg "Stopping daemon: $NAME "
      start-stop-daemon --stop --quiet --exec $DAEMON
}

restart() {
                $0 stop && sleep 2 && $0 start

}

status(){
      pidof $DAEMON > /dev/null 2>&1
      RETVAL=$?
      if [ $RETVAL -ne 0 ]; then
            echo "$NAME is not running"
            exit $RETVAL
      else
            echo "$NAME is running"
      fi
}

reload(){
      kill -1 $(cat $PIDFILE)
      RETVAL=$?
      if [ $RETVAL -eq 0 ]; then
            echo "$NAME reloading successfully"
      else
            echo "$NAME reloading failed"
            exit $RETVAL
      fi
}

case "$1" in
  start)
      start
      ;;
  stop)
      stop
      ;;
  restart)
      restart
  ;;
  reload)
      reload
  ;;
  status)
      status
  ;;
  *)
      echo "Usage: $0 {start|stop|restart|reload|status}"
      exit 1
esac

exit 0



merge bine cu asta tie nu-ti merge ca folosesti shell si nu bash

LE : in config la oscam sa pui la pid file /var/run/oscam.pid
dupa ce le-ai urcat in consola
root@raspberrypi:~# systemctl daemon-reload
root@raspberrypi:~# service oscam reload
User avatar
allsattnt
Standard User
Posts: 237
Joined: 07 Dec 2014 19:15

Re: RASPBERRY PI 3 B

Unread postby allsattnt » 10 Jan 2017 09:43

Nu vrea nici asa.
Am luat totul de aici.
Nu porneste decat din consola.
E prima data cand traiesc,asa ca e omeneste sa mai si gresesc!
User avatar
allsattnt
Standard User
Posts: 237
Joined: 07 Dec 2014 19:15

Re: RASPBERRY PI 3 B

Unread postby allsattnt » 10 Jan 2017 09:52

E ok acum,am refacut totul.
Nu am dat reboot dupa operatia de formare a comenzii oscam in init.d si probabil asta mi-a stricat configul.
Multumesc.
E prima data cand traiesc,asa ca e omeneste sa mai si gresesc!
User avatar
allsattnt
Standard User
Posts: 237
Joined: 07 Dec 2014 19:15

Re: RASPBERRY PI 3 B

Unread postby allsattnt » 11 Jan 2017 09:11

Pentru , ca, dupa restart sa porneasca automat oscamul,trebuie setat la boot options a porni pe autologin desktop.


Image

Image
E prima data cand traiesc,asa ca e omeneste sa mai si gresesc!

Return to “Raspberry Pi”

Who is online

Users browsing this forum: No registered users and 10 guests