Ciao,
ho un problema nella creazione di un servizio, va in errore e non riesco a capire il motivo.
Ho anche provato a creare un servizio "stupido" di esempio:
questo è il contenuto di test.daemon:codice:$ uname -a Linux test02 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux $ mkdir server $ cd server $ touch test.daemon $ chmod +rx test.daemon $ nano test.daemon
dopodiche..codice:### BEGIN INIT INFO # Provides: test # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start test at boot time # Description: Just a test ### END INIT INFO #!/bin/bash # chkconfig: 2345 20 80 # description: test # Source function library. #. /etc/init.d/functions start() { # code to start app comes here # example: daemon program_name & echo "test start" } stop() { # code to stop app comes here # example: killproc program_name echo "test stop" } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart}" esac exit 0
codice:$ cd /etc/init.d/ $ sudo -s # ln -s /home/utente/server/test.daemon test # ls -la lrwxrwxrwx 1 root root 35 Jan 21 13:56 discosrv.daemon -> /home/utente/server/discosrv.daemon # update-rc.d test defaults # service test start Job for test.service failed because the control process exited with error code. See "systemctl status test.service" and "journalctl -xe" for details.codice:# systemctl status test.service â— test.service - LSB: Start test at boot time Loaded: loaded (/etc/init.d/test; bad; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2017-01-21 14:05:13 UTC; 31s ago Docs: man:systemd-sysv-generator(8) Process: 1957 ExecStart=/etc/init.d/test start (code=exited, status=203/EXEC) Jan 21 14:05:13 test02 systemd[1]: Starting LSB: Start test at boot time... Jan 21 14:05:13 test02 systemd[1]: test.service: Control process exited, code=exited status=203 Jan 21 14:05:13 test02 systemd[1]: Failed to start LSB: Start test at boot time. Jan 21 14:05:13 test02 systemd[1]: test.service: Unit entered failed state. Jan 21 14:05:13 test02 systemd[1]: test.service: Failed with result 'exit-code'.cosa c'è di sbagliato?codice:# journalctl -xe -- -- The start-up result is done. Jan 21 14:03:43 test02 python3[1216]: 2017/01/21 14:03:43.609062 INFO Agent WALinuxAgent-2.1.5 launched with command 'python3 -u /usr/sbin/waagent -run-exthandlers' is Jan 21 14:03:43 test02 python3[1216]: 2017/01/21 14:03:43.649888 INFO Event: name=WALinuxAgent, op=Enable, message=Agent WALinuxAgent-2.1.5 launched with command 'pytho Jan 21 14:05:03 test02 systemd[1]: Reloading. Jan 21 14:05:03 test02 systemd-sysv-generator[1912]: stat() failed on /etc/init.d/discosrv.daemon, ignoring: No such file or directory Jan 21 14:05:03 test02 systemd[1]: apt-daily.timer: Adding 4h 56min 31.370059s random time. Jan 21 14:05:03 test02 systemd[1]: snapd.refresh.timer: Adding 4h 21min 39.795374s random time. Jan 21 14:05:03 test02 systemd[1]: Started ACPI event daemon. -- Subject: Unit acpid.service has finished start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit acpid.service has finished starting up. -- -- The start-up result is done. Jan 21 14:05:13 test02 systemd[1]: Starting LSB: Start test at boot time... -- Subject: Unit test.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit test.service has begun starting up. Jan 21 14:05:13 test02 systemd[1957]: test.service: Failed at step EXEC spawning /etc/init.d/test: Exec format error -- Subject: Process /etc/init.d/test could not be executed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- The process /etc/init.d/test could not be executed and failed. -- -- The error number returned by this process is 8. Jan 21 14:05:13 test02 systemd[1]: test.service: Control process exited, code=exited status=203 Jan 21 14:05:13 test02 systemd[1]: Failed to start LSB: Start test at boot time. -- Subject: Unit test.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit test.service has failed. -- -- The result is failed. Jan 21 14:05:13 test02 systemd[1]: test.service: Unit entered failed state. Jan 21 14:05:13 test02 systemd[1]: test.service: Failed with result 'exit-code'. Jan 21 14:06:16 test02 sudo[1967]: utente : TTY=pts/0 ; PWD=/home/utente/server ; USER=root ; COMMAND=/bin/bash Jan 21 14:06:16 test02 sudo[1967]: pam_unix(sudo:session): session opened for user root by utente(uid=0)

Rispondi quotando
