• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1166
  • Last Modified:

getlogin: Inappropriate ioctl for device

As part of New Payroll system implementation, we have a problem starting the server process using cron. The following error message appears

Your "cron" job on stolly

produced the following output:

getlogin: Inappropriate ioctl for device

Running the process from the command line works fine.
2 Solutions
The following link shows a very similar problem:

Even if this isn't a Python program, the principle remains the same - the "getlogin" function appears to be expecting keyboard input (or at least for a keyboard to be attached) and fails when it can't read from an "appropriate" device.  I presume that the startup process then fails? (Otherwise it would just be a curiosity, rather than a problem ;-)

If this _is_ a Python program, you may get useful advice here:
Your program is not intended for running from cron. Cron jobs have no controlling terminal. Manual page 'man getlogin' says:

If getlogin()  is  called  within  a  process  that  is  not
     attached  to  a  terminal,  it  returns  a null pointer. The
     correct procedure for determining the login name is to  call
     cuserid(3C),  or  to call getlogin() and if it fails to call

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now