You are not logged in.
Pages: 1
Hi!
I tried to use cloudprint.py to use Google cloudprint with my USB printers. Running it as user and root is working fine ("normal" and daemon mode). The problems started, when I tried to create a systemd service file, to start it automatically at boot.
Here is the service file I came up with ![]()
[Unit]
Description=Google Cloudprint
Requires=cups.service
After=cups.service network.target
[Service]
User=root
Type=forking
PIDFile=/var/run/cloudprint.pid
ExecStart=/usr/bin/python2 /usr/bin/cloudprint -d -p /var/run/cloudprint.pid
[Install]
WantedBy=multi-user.targetThe first problem was that the daemonized app still wanted to write to /dev/tty. I changed the paths for stdout/stderr to /dev/null and got daemon mode working.
Authentication/login and printer update is working fine, but after some time the service gets terminated by systemd ("operation timed out"). If I start the script manually (without systemd) it keeps running, but if I start it using systemd it is terminated after about one minute.
x200s# systemctl status cloudprint.service
cloudprint.service - Google Cloudprint
Loaded: loaded (/etc/systemd/system/cloudprint.service; disabled)
Active: failed (Result: exit-code) since Fri 2013-02-15 22:22:40 CET; 2min 27s ago
Process: 10939 ExecStart=/usr/bin/python2 /usr/bin/cloudprint -d -p /var/run/cloudprint.pid (code=exited, status=1/FAILURE)
Feb 15 22:21:10 x200s systemd[1]: Starting Google Cloudprint...
Feb 15 22:21:14 x200s cloudprint.py[10939]: Updated Printer HP_Deskjet_5900_series_USB_CN68G1Z0DM04KF_HPLIP
Feb 15 22:21:16 x200s cloudprint.py[10939]: Updated Printer HP_DJ_5940
Feb 15 22:21:19 x200s cloudprint.py[10939]: Updated Printer Deskjet_6980_series
Feb 15 22:21:21 x200s cloudprint.py[10939]: Updated Printer HP5940
Feb 15 22:21:23 x200s cloudprint.py[10939]: Updated Printer HP_5940_rbp
Feb 15 22:22:40 x200s systemd[1]: cloudprint.service operation timed out. Terminating.
Feb 15 22:22:40 x200s systemd[1]: cloudprint.service: control process exited, code=exited status=1
Feb 15 22:22:40 x200s systemd[1]: Failed to start Google Cloudprint.
Feb 15 22:22:40 x200s systemd[1]: Unit cloudprint.service entered failed stateI could not get any other information on what could trigger the error. As far as I have seen no exception gets thrown and systemd terminates the process.
The script is using python-daemon (DaemonRunner). Could this cause problems in combination with systemd or the pid-file? I am not very experienced with troubleshooting systemd services or python daemons ![]()
Any help is greatly appreciated ![]()
Edit: If I choose "oneshot" instead of "forking" it works, but I'm not sure if this is just a hacky way to get it running or if this is ok?
thx!
matt
Last edited by m@tt (2013-02-16 10:09:07)
Offline
Pages: 1