[solved] Unable to restart a service via scheduled jobs / Inappropriate ioctl for device

  • In the past I had issues with the FTP service, obviously a problem nobody could figure out. I did find a workaround, though - but now that doesn't work anymore.
    I'm trying to restart a service - namely proftpd - via scheduled jobs once a day. The way I have tried to do so is via a direct command or by executing a shell script. When running the job manually, both ways work perfectly fine, but when triggered at the specified time, both will fail, the error message reads:

    Code
    mesg: ttyname failed: Inappropriate ioctl for device


    Here's the command:
    2019-09-25_202806.jpg


    And here's the call for the script:


    2019-09-25_202840.jpg
    The script itself is very simple, here are it's entire contents:

    Bash
    #!/bin/sh
    service proftpd restart


    I have searched around for "Inappropriate ioctl for device" with several hits, but I just can't figure out, how to solve the issue here. As said, when I execute either option manually on the scheduled jobs page, they work absolutely fine, ftp will immediately restart.

  • I never run commands directly in cron jobs. And I assume OMV use cron behind the curtains. Instead I run commands from scripts, something like this:


    cd folder_where_the_command_should_run && /bin/bash /full/path/and/name/of/script.sh


    It seems that otherwise the environment can be different from when you run a command manually. Usually it doesn't matter, but sometimes it does... This way the script runs exactly(?) the same as if launched from the command line.


    I add cron jobs by adding lines to /etc/crontab

    Be smart - be lazy. Clone your rootfs.
    OMV 5: 9 x Odroid HC2 + 1 x Odroid HC1 + 1 x Raspberry Pi 4

    Edited once, last by Adoby ().

  • Thanks - but isn't that exactly what I did with my second option of running a script?
    Or should I change some of the syntax?
    Again, when executed manually in OMV, it does work...

  • Have you tried using this for the command in the scheduled job?


    /usr/sbin/service proftpd restart

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 5.x on ASRock Rack C2550D4I C0 Stepping - 16GB ECC - Silverstone DS380 + Silverstone DS380 DAS Box.

  • Have you tried using this for the command in the scheduled job?


    /usr/sbin/service proftpd restart

    I did not but just have done so.
    Unfortunately, the same result as with the other two solutions - manual execution works like a charm, but when triggered by the set time, the same error "mesg: ttyname failed: Inappropriate ioctl for device" was sent to me by e-mail.

  • I know I have read that thread before - and thought the problem didn't apply to me, because "it simply creates an annoying output, nothing more." which was not true in my case - since the service didn't restart.
    It seems I never tried to edit /root/.profile as suggested, but now did after your suggestion... and it seems to work. I didn't receive any error message by e-mail and I can see in the logs proftp did indeed restart.
    Hooray! Thanks a lot!!

  • Glad I could help. You might want to edit the Subject of the first post to indicate [SOLVED] and change the status to Resolved.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 5.x on ASRock Rack C2550D4I C0 Stepping - 16GB ECC - Silverstone DS380 + Silverstone DS380 DAS Box.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!