Sample Header Ad - 728x90

What is wrong with my systemd unit file?

2 votes
1 answer
859 views
Here is my unit file: [Unit] Description=Backend Service After=mariadb.service Requires=mariadb.service [Service] Type=simple ExecStart=/var/www/html/pythonscripts/Backend.py [Install] Alias=BEd WantedBy=basic.target Here is what I previous wrote that used to work (instructions for setting up the service): BEd.service must be moved to /etc/systemd/system systemctl daemon-reload systemctl enable BEd systemctl start BEd Here is what the /etc/systemd/system folder currently contains: basic.target.wants dbus-org.freedesktop.NetworkManager.service default.target.wants sockets.target.wants BEd dbus-org.freedesktop.nm-dispatcher.service getty.target.wants sysinit.target.wants BEd.service default.target multi-user.target.wants system-update.target.wants Here is the error message after rebooting: [root@BEKappa ~]# systemctl status -l BHd BEd.service - Backend Service Loaded: loaded (/etc/systemd/system/BEd.service; enabled) Active: failed (Result: exit-code) since Sat 2016-01-16 18:39:27 EST; 34s ago Process: 3852 ExecStart=/var/www/html/pythonscripts/BEd.py (code=exited, status=1/FAILURE) Main PID: 3852 (code=exited, status=1/FAILURE) CGroup: /system.slice/BEd.service Jan 16 18:39:27 BEKappa BEd.py: Traceback (most recent call last): Jan 16 18:39:27 BEKappa BEd.py: File "/var/www/html/pythonscripts/BEd.py", line 147, in Jan 16 18:39:27 BEKappa BEd.py: cur.execute(network_adapters_sql) Jan 16 18:39:27 BEKappa BEd.py: File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute Jan 16 18:39:27 BEKappa BEd.py: self.errorhandler(self, exc, value) Jan 16 18:39:27 BEKappa BEd.py: File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler Jan 16 18:39:27 BEKappa BEd.py: raise errorclass, errorvalue Jan 16 18:39:27 BEKappa BEd.py: _mysql_exceptions.ProgrammingError: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \'\'IP\', \'ethernet\', \'connecting\', \'(getting\', \'enp7s0\', \'yes\', \'1000\', \'"dhcp"\', )\' at line 1') Jan 16 18:39:27 BEKappa systemd: BEd.service: main process exited, code=exited, status=1/FAILURE Jan 16 18:39:27 BEKappa systemd: Unit BEd.service entered failed state. I am 100% sure it isn't the service code, since it starts just fine after reboot manually (i.e. systemctl start BEd). Based on the error I'm 90% sure mariaDB isn't finished loading when BEd starts, it fails on the first SQL statement of the program. Yet, this unit file worked before, and it's currently working on another server. So I am baffled.
Asked by gunslingor (149 rep)
Jan 17, 2016, 12:13 AM
Last activity: May 27, 2016, 05:41 PM