2016-08-27 11 views
0

현재 멀티미디어 시스템에서 작업하고 있습니다.이 시스템은 PS4 DS4 (ds4drv 및 약간의 스크립팅 사용)를 통해 제어하려고합니다. Bash/Terminal을 수동으로 시작하면 모든 것이 매력처럼 작동합니다. 그러나 crontab을 통해 시작하면 거의 아무것도 작동하지 않습니다.Env & Crontab -> 프로그램은 bash에서 작동하지만 cron을 통해 시작하지는 않습니다.

는 지금까지 어떤 연구를하고 내 환경 바르에 오류가 어떻게 든 관련이있는 것처럼 그것은 보인다.

또한 ds4drvcron의 바르 시작하면 충돌 유지 :

[email protected]:~$ env - `cat ~/cronenv` /bin/sh 
$ /usr/local/bin/ds4drv 
[info][controller 1] Created devices /dev/input/js2 (joystick) /dev/input/event25 (evdev) 
[info][controller 1] Connected to Bluetooth Controller (1C:66:6D:64:2F:74 hidraw5) 
[info][hidraw] Scanning for devices 
[info][controller 1] Battery: 75% 
[info][controller 1] Switching to profile: kbmouse 
[info][controller 1] Switching to profile: gaming 
Exception in thread Thread-1: 
Traceback (most recent call last): 
    File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner 
    self.run() 
    File "/usr/lib/python2.7/threading.py", line 763, in run 
    self.__target(*self.__args, **self.__kwargs) 
    File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 110, in run 
    self.loop.run() 
    File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 105, in run 
    callback() 
    File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 107, in read_report 
    self.fire_event("device-report", report) 
    File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 39, in fire_event 
    self.loop.fire_event(event, *args) 
    File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 90, in fire_event 
    self.process_events() 
    File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 96, in process_events 
    callback(*args) 
    File "build/bdist.linux-x86_64/egg/ds4drv/action.py", line 73, in _handle_report 
    self.handle_report(report) 
    File "build/bdist.linux-x86_64/egg/ds4drv/actions/binding.py", line 105, in handle_report 
    binding.callback(report, *binding.args) 
    File "build/bdist.linux-x86_64/egg/ds4drv/actions/binding.py", line 62, in <lambda> 
    lambda r: self.controller.next_profile()) 
    File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 62, in next_profile 
    self.load_profile(self.profiles[next_index]) 
    File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 48, in load_profile 
    self.load_options(profile_options) 
    File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 94, in load_options 
    self.fire_event("load-options", options) 
    File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 39, in fire_event 
    self.loop.fire_event(event, *args) 
    File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 90, in fire_event 
    self.process_events() 
    File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 96, in process_events 
    callback(*args) 
    File "build/bdist.linux-x86_64/egg/ds4drv/actions/input.py", line 75, in load_options 
    self.joystick.device.close() 
    File "/usr/lib/python2.7/dist-packages/evdev/uinput.py", line 115, in close 
    self.device.close() 
AttributeError: 'NoneType' object has no attribute 'close' 

crontab이 : 만 위의 출력에서 ​​모든 경우

@reboot /usr/local/bin/ds4drv > /home/hehxes/ds4drv/verbose.log 

로그 쇼를.

는 이미 cron의 환경

@reboot /bin/bash; . /home/hehxes/.profile; /usr/bin/screen -dmS ds4drv-screen /usr/local/bin/ds4drv 

하지만 운이없이에게 지정하는 것을 시도했다.

내가 뭘 잘못하고 있니?

답변

0

당신이 잘못 떠들썩한 파티를 호출 한 후 세미콜론이있다. 다음과 같은 내용으로 스크립트를 작성하십시오 (의 말을하자 /home/hehxes/run_ds4drv.sh) :

#!/usr/bin/env bash 
. /home/hehxes/.profile 
/usr/local/bin/ds4drv 

그런 다음 파일 권한 실행 추가

chmod a+x /home/hehxes/run_ds4drv.sh 

을 그리고 크론의 스크립트를 호출 : 홈/hehxes/ds4drv/verbose.log`이 나를 위해 일한 />

@reboot /home/hehxes/run_ds4drv.sh > /home/hehxes/ds4drv/verbose.log 
+1

감사합니다,하지만 마지막에'는 sudo crontab을 -e \ n 개의 @reboot 스와 hehxes -c '화면 -dms DS4 sudo는 ds4drv – hehxes