Tentativa de executar o italc na inicialização

0

Sou um estudante administrador de sistemas para o programa CS de minhas escolas e usamos um software chamado italc para monitorar os alunos durante os exames e as aulas e assim por diante. No entanto, a única maneira que consegui fazê-lo funcionar é adicionar o executável ica dentro do diretório pessoal de cada aluno para que ele seja executado quando fizerem login.

O professor a quem eu denuncio gostaria de inicializar na inicialização do sistema. Então eu pesquisei e escrevi um script LSBInit e o coloquei no init.d. No entanto, quando tento executá-lo como um serviço, em vez de apenas através do init.d, ele não será iniciado. Eu acredito que isso é porque XOpenDisplay está a falhar a execução no ambiente limpo que correu esse serviço é executado, mas não tenho certeza de como remediar isso. Abaixo está meu script init.d.

#!/bin/bash
## BEGIN INIT INFO
# Provides:     ica
# Default-Start:    2 3 4 5
# Default-Stop:     0 1 6
# Short-Description:    italc daemon
### END INIT INFO


# Using the lsb functions to perform the operations.
. /lib/lsb/init-functions

# Process name ( For display )
NAME=ica

# Daemon name, where is the actual executable
DAEMON=/bin/ica

# pid file for the daemon
PIDFILE=/var/run/ica.pid
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
DISPLAY=":0"

# If the daemon is not there, then exit.
test -x $DAEMON || exit 5

case $1 in
start)
# Checked the PID file exists and check the actual status of process
    if [ -e $PIDFILE ]; then
        status_of_proc -p $PIDFILE $DAEMON "$NAME process" $$ status="0" || status="$?"
        # If the status is SUCCESS then don't need to start again.
        if [ "$status" = "0" ]; then
            exit # Exit
        fi
    fi
    # Start the daemon.
    log_daemon_msg "Starting the process" "$NAME"
    # Start the daemon with the help of start-stop-daemon
    # Log the message appropriately
    if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON --make-pidfile ; then
        log_end_msg 0
    else
        log_end_msg 1
    fi
;;
stop)
# Stop the daemon.
    if [ -e $PIDFILE ]; then
        status_of_proc -p $PIDFILE $DAEMON "Stopping the $NAME process" && status="0" || status="$?"
        echo "$status"
        if [ "$status" = "0" ]; then
            start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
            /bin/rm -rf $PIDFILE
        fi
    else
        log_daemon_msg "$NAME process is not running"
        log_end_msg 0
    fi
;;
restart)
# Restart the daemon.
    $0 stop && sleep 2 && $0 start
;;
status)
# Check the status of the process.
    if [ -e $PIDFILE ]; then
        status_of_proc -p $PIDFILE $DAEMON "$NAME process" && exit 0 || exit $?
    else
        log_daemon_msg "$NAME Process is not running"
        log_end_msg 0
    fi
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 (start|stop|restart|status)"
    exit 2
;;
esac    
    
por Matt G. 09.03.2016 / 07:27

1 resposta

0

vá para as preferências de aplicativos de inicialização e clique em adicionar digite o nome do programa e use o comando do arquivo ou coisa e clique em adicionar e é sobre isso: D

    
por kasper rook 09.03.2016 / 20:41