Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm having a really strange problem that only occurs when a server process is launched by cron. The environment is an Ubuntu 12.0.4 LTS distro running in an Azure VM, with an exposed endpoint to the port the server process listens on.

Here's the crontab entry:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/username/ChatScript/LinuxChatScript32 2> /home/username/ChatScript/cronserver.log

Here's how the server process normally works:

  • A client opens a TCP connection to the process and sends data immediately
  • The server process returns a string and closes the socket

If I run the server process directly from a command line (not launched by cron), everything works fine and I see the response string from the server process. But if cron launches the server process, my test client program can connect fine, send the initial data fine, and the socket closes. But the response string from the server is always empty (0 length). If the server process was "printing" to stdout or some such entity that can be redirected I could understand this. But since it sends its response straight out the socket to the client, I'm baffled. What could cause this kind of behavior?

NOTE: If you're wondering about the 5 minute launch intervals, the server process checks to see if the port it needs is already busy and if so, simply exits. The 5 minute interval schedule serves as a crash/reload mechanism to reload the server process if it goes down.

share|improve this question
1  
Can we see your script (or at least the important bits)? Have you tried straceing the running server process to check that nothing untoward happens when the client connects? –  Flup Jun 5 '13 at 15:14
    
@Flup - The author of the server process software, has just confirmed that they too are getting the error under Linux. I had assumed it was something I was doing wrong. Once I hear back from them as to the nature of the problem, I will update this post. Thanks for replying. –  Robert Oschler Jun 5 '13 at 18:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.