I’m running debian on my BBB (2014-05-14), and I noticed that you guys are using systemd so when I made my new server app I’m using systemd. Here’s my server file, pretty simple:
[Unit]
Description=CS XMLRPC Server
Requires=network.target
After=network.target
[Service]
ExecStart=/usr/local/bin/cs_xmlrpc 8888
[Install]
WantedBy=multi-user.target
I can start/stop it fine, however I can’t seem to find where the stdout/stderr from the program is going. I’ve checked /var/log/syslog, /var/log/messages, dmesg, and systemd-journalctl. None of them seem to contain the output from my program. I’ve read everywhere that it’s either syslog or journalctl, so I don’t know where else to look.
Any ideas? Should I use one of the debian testing snapshots instead?
Yeah, I’ve seen that elsewhere before but it still doesn’t work:
root@anna-bone:~/cs_xmlrpc/deb$ systemctl start cs_xmlrpc.service
root@anna-bone:~/cs_xmlrpc/deb$ systemctl status cs_xmlrpc.service
cs_xmlrpc.service - CS XMLRPC Server
Loaded: loaded (/lib/systemd/system/cs_xmlrpc.service; enabled)
Active: active (running) since Tue, 13 Jan 2015 15:52:36 +0000; 8s ago
Main PID: 3565 (cs_xmlrpc)
CGroup: name=systemd:/system/cs_xmlrpc.service
└ 3565 /usr/local/bin/cs_xmlrpc 8888
root@anna-bone:~/cs_xmlrpc/deb$ systemctl stop cs_xmlrpc.service
root@anna-bone:~/cs_xmlrpc/deb$ systemctl status cs_xmlrpc.service
cs_xmlrpc.service - CS XMLRPC Server
Loaded: loaded (/lib/systemd/system/cs_xmlrpc.service; enabled)
Active: inactive (dead) since Tue, 13 Jan 2015 15:54:10 +0000; 1s ago
Process: 3565 ExecStart=/usr/local/bin/cs_xmlrpc 8888 (code=killed, signal=TERM)
CGroup: name=systemd:/system/cs_xmlrpc.service
If I run the daemon manually you can see what it should output:
root@anna-bone:~/cs_xmlrpc/deb$ ../cs_xmlrpc
Using config file /etc/cs_xmlrpc.d/cs_xmlrpc.conf
Opened /dev/i2c-1 with i2c address 0x40
Global ID: 0x03e5
Running XML-RPC server at http://anna-bone:8888
This is just to stdout, I’m not doing anything fancy here (just printfs)…
Do you think I just have to update to one of the newer debian snapshots?
Sorry, but unfortunately I don't know systemd that well.
I have an old snapshot of Debian (from July 2014) and the status command works fine. I'm using python to code. I know that systemctl can throw output acording to journal formatting type:
But maybe it has something to do with on how the prinf is handling the stdout. I haven't been programming in C, but maybe you can try using fprintf(stdout, "Hello!");
I have no ideia if it is going to work, but is worth trying.
Haha, that’s definitely a creative solution! I’ve used screen in the past quite a bit and switched to tmux, which seems to be installed by default. Doesn’t matter for the situation you’re using it in but it’s definitely better.
For now I’m just ignoring it. I’m not at all sure why the output of my program isn’t going anywhere. You would think systemd-journalctl would catch it but it doesn’t seem to. Oh well, I’ll have to debug later.
The output of stderr error can be found using “sudo systemctl status SERVICE_NAME.service”; I’m not sure where stdout is going (perhaps /dev/null?). Irrespective, when doing systemd development, I always “tee” both stdout and stderr into a log file under my home directory. By using tee, I see the stdout when running with a debugger, and it is also logged when running at startup. Since I have standardized on using python for all scripts (whenever possible), this is relatively simple using the imported sys module (I can post if there is interest and someone can explain simply how to include code in a post).
No, I didn’t realize the date of the post, just had some time for browsing (in between family interactions) and thought I might be able to offer some suggestions. I see you are also browsing on Christmas at dinner time. Thank you for your suggestions on how I can improve my life; it’s always nice to get positive constructive criticisms, although they don’t seem to have much to do with the technical matter. Perhaps you could enlighten me with the rules of posting?